Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / CallbackValidatorAttribute.cs / 1305376 / 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
- SharedPerformanceCounter.cs
- EntryPointNotFoundException.cs
- UIElementParaClient.cs
- MouseBinding.cs
- Exceptions.cs
- GradientStop.cs
- GridEntry.cs
- XPathItem.cs
- Adorner.cs
- TakeOrSkipWhileQueryOperator.cs
- DataControlPagerLinkButton.cs
- XmlReflectionMember.cs
- PropertySourceInfo.cs
- ListMarkerSourceInfo.cs
- XPathParser.cs
- SoapAttributeOverrides.cs
- RoutedPropertyChangedEventArgs.cs
- LoginView.cs
- UnaryExpression.cs
- TdsParameterSetter.cs
- ValueTypeIndexerReference.cs
- EndpointAddressMessageFilterTable.cs
- SymbolType.cs
- DataSourceProvider.cs
- SiteOfOriginPart.cs
- DocumentCollection.cs
- GenerateScriptTypeAttribute.cs
- PrintDialogException.cs
- FixedStringLookup.cs
- DrawingContextDrawingContextWalker.cs
- QuaternionAnimation.cs
- SpotLight.cs
- TransformPattern.cs
- Int64AnimationBase.cs
- _SslStream.cs
- DrawingAttributeSerializer.cs
- CodeArgumentReferenceExpression.cs
- ServiceBuildProvider.cs
- CodeLabeledStatement.cs
- ToolStripMenuItemDesigner.cs
- DoubleAnimationBase.cs
- WebConfigurationManager.cs
- DataGridRow.cs
- FormatterConverter.cs
- AngleUtil.cs
- COM2EnumConverter.cs
- ResourceManager.cs
- Type.cs
- AsnEncodedData.cs
- LogSwitch.cs
- DESCryptoServiceProvider.cs
- OrderedDictionary.cs
- _HTTPDateParse.cs
- PageParser.cs
- ParameterToken.cs
- ThreadAbortException.cs
- TerminateWorkflow.cs
- TextEndOfSegment.cs
- HashCryptoHandle.cs
- BaseCodeDomTreeGenerator.cs
- RequestTimeoutManager.cs
- SoapExtensionStream.cs
- Hashtable.cs
- AppSettingsSection.cs
- RenderingEventArgs.cs
- SchemaNames.cs
- QilLoop.cs
- ConfigErrorGlyph.cs
- InvalidComObjectException.cs
- EmptyQuery.cs
- GroupStyle.cs
- PersistenceTypeAttribute.cs
- CommandLineParser.cs
- StylusCollection.cs
- ProcessHostConfigUtils.cs
- TerminatorSinks.cs
- FastEncoderStatics.cs
- PolyLineSegment.cs
- MimeReturn.cs
- XpsInterleavingPolicy.cs
- XmlDataImplementation.cs
- StringAnimationBase.cs
- PartitionerQueryOperator.cs
- XmlIgnoreAttribute.cs
- CommandSet.cs
- HtmlEmptyTagControlBuilder.cs
- ClientFormsAuthenticationCredentials.cs
- ValidatorCollection.cs
- EntityDescriptor.cs
- InfoCardProofToken.cs
- ColumnBinding.cs
- FreeFormDesigner.cs
- X509SecurityToken.cs
- StackOverflowException.cs
- TextSerializer.cs
- Int32CollectionConverter.cs
- ComplexBindingPropertiesAttribute.cs
- ZipIOLocalFileHeader.cs
- RemotingServices.cs
- KeyFrames.cs