Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Configuration / System / Configuration / CallbackValidatorAttribute.cs / 1 / CallbackValidatorAttribute.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Configuration.Internal; using System.Collections; using System.Collections.Specialized; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; namespace System.Configuration { [AttributeUsage(AttributeTargets.Property)] public sealed class CallbackValidatorAttribute : ConfigurationValidatorAttribute { private Type _type = null; private String _callbackMethodName = String.Empty; private ValidatorCallback _callbackMethod; public override ConfigurationValidatorBase ValidatorInstance { get { if (_callbackMethod == null) { if (_type == null) { throw new ArgumentNullException("Type"); } if (!String.IsNullOrEmpty(_callbackMethodName)) { MethodInfo methodInfo = _type.GetMethod(_callbackMethodName, BindingFlags.Public | BindingFlags.Static); if (methodInfo != null) { ParameterInfo[] parameters = methodInfo.GetParameters(); if ((parameters.Length == 1) && (parameters[0].ParameterType == typeof(Object))) { _callbackMethod = (ValidatorCallback)Delegate.CreateDelegate(typeof(ValidatorCallback), methodInfo); } } } } if (_callbackMethod == null) { throw new System.ArgumentException(SR.GetString(SR.Validator_method_not_found, _callbackMethodName)); } return new CallbackValidator(_callbackMethod); } } public CallbackValidatorAttribute() { } public Type Type { get { return _type; } set { _type = value; _callbackMethod = null; } } public String CallbackMethodName { get { return _callbackMethodName; } set { _callbackMethodName = value; _callbackMethod = null; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Configuration.Internal; using System.Collections; using System.Collections.Specialized; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; namespace System.Configuration { [AttributeUsage(AttributeTargets.Property)] public sealed class CallbackValidatorAttribute : ConfigurationValidatorAttribute { private Type _type = null; private String _callbackMethodName = String.Empty; private ValidatorCallback _callbackMethod; public override ConfigurationValidatorBase ValidatorInstance { get { if (_callbackMethod == null) { if (_type == null) { throw new ArgumentNullException("Type"); } if (!String.IsNullOrEmpty(_callbackMethodName)) { MethodInfo methodInfo = _type.GetMethod(_callbackMethodName, BindingFlags.Public | BindingFlags.Static); if (methodInfo != null) { ParameterInfo[] parameters = methodInfo.GetParameters(); if ((parameters.Length == 1) && (parameters[0].ParameterType == typeof(Object))) { _callbackMethod = (ValidatorCallback)Delegate.CreateDelegate(typeof(ValidatorCallback), methodInfo); } } } } if (_callbackMethod == null) { throw new System.ArgumentException(SR.GetString(SR.Validator_method_not_found, _callbackMethodName)); } return new CallbackValidator(_callbackMethod); } } public CallbackValidatorAttribute() { } public Type Type { get { return _type; } set { _type = value; _callbackMethod = null; } } public String CallbackMethodName { get { return _callbackMethodName; } set { _callbackMethodName = value; _callbackMethod = null; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DrawTreeNodeEventArgs.cs
- UntypedNullExpression.cs
- Currency.cs
- Stylesheet.cs
- WebPartVerbCollection.cs
- XamlTreeBuilder.cs
- ClientEndpointLoader.cs
- ShaderEffect.cs
- PrinterSettings.cs
- DataSourceHelper.cs
- UnsafeNativeMethods.cs
- PipelineModuleStepContainer.cs
- UserControl.cs
- HostProtectionPermission.cs
- Msmq3PoisonHandler.cs
- invalidudtexception.cs
- CodeBlockBuilder.cs
- CancelEventArgs.cs
- PropertyValueChangedEvent.cs
- DynamicILGenerator.cs
- DbgUtil.cs
- EntityWrapper.cs
- RootProjectionNode.cs
- Soap12ServerProtocol.cs
- SoapExtension.cs
- SimpleParser.cs
- DuplexClientBase.cs
- UpdatePanelControlTrigger.cs
- ProcessModelInfo.cs
- Int16Storage.cs
- GlyphingCache.cs
- XamlToRtfWriter.cs
- LinearGradientBrush.cs
- ReadOnlyActivityGlyph.cs
- ProfileSettingsCollection.cs
- EventlogProvider.cs
- AnnotationResource.cs
- PageWrapper.cs
- NodeFunctions.cs
- EnlistmentTraceIdentifier.cs
- TypeLibConverter.cs
- HtmlGenericControl.cs
- TypeSystem.cs
- InfoCardSymmetricCrypto.cs
- WindowsSolidBrush.cs
- SqlDataSourceCommandEventArgs.cs
- SelectionRange.cs
- PerspectiveCamera.cs
- RtfFormatStack.cs
- RelationshipConverter.cs
- SessionStateItemCollection.cs
- Padding.cs
- CompilationUnit.cs
- TableLayoutSettings.cs
- SynchronizedPool.cs
- RightsManagementInformation.cs
- CodeValidator.cs
- AmbiguousMatchException.cs
- SafeProcessHandle.cs
- AuthenticationService.cs
- StylusDevice.cs
- SBCSCodePageEncoding.cs
- UnsafeNativeMethods.cs
- PerspectiveCamera.cs
- TriggerBase.cs
- WsdlParser.cs
- AdCreatedEventArgs.cs
- CodePrimitiveExpression.cs
- SplitterEvent.cs
- RouteCollection.cs
- SamlAssertion.cs
- ToolBar.cs
- TreeViewDesigner.cs
- UnsafeNativeMethods.cs
- SystemPens.cs
- HtmlProps.cs
- PKCS1MaskGenerationMethod.cs
- TypeInfo.cs
- TextTreeObjectNode.cs
- ComboBox.cs
- ViewBox.cs
- WinHttpWebProxyFinder.cs
- AdRotator.cs
- OuterGlowBitmapEffect.cs
- PropertyDescriptor.cs
- TreeBuilderXamlTranslator.cs
- AssemblyHash.cs
- activationcontext.cs
- EndpointInfoCollection.cs
- BypassElement.cs
- SafeRightsManagementSessionHandle.cs
- XmlIterators.cs
- CompilationRelaxations.cs
- EntitySqlQueryCacheEntry.cs
- CodeAttributeArgumentCollection.cs
- VolatileEnlistmentState.cs
- TextOnlyOutput.cs
- CircleHotSpot.cs
- DataPagerField.cs
- TraceLevelHelper.cs