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
- OdbcCommand.cs
- CollectionsUtil.cs
- RecordBuilder.cs
- DocumentReference.cs
- RegexMatchCollection.cs
- GridPattern.cs
- Cast.cs
- ScopelessEnumAttribute.cs
- WebPartConnectionCollection.cs
- TimeStampChecker.cs
- AsyncOperation.cs
- PersonalizationState.cs
- Fonts.cs
- LoadRetryStrategyFactory.cs
- WebCategoryAttribute.cs
- TimeSpanConverter.cs
- TransactionManager.cs
- Grid.cs
- SoapBinding.cs
- M3DUtil.cs
- TextEditorTables.cs
- HorizontalAlignConverter.cs
- SettingsPropertyNotFoundException.cs
- DataRelationCollection.cs
- SQLDoubleStorage.cs
- XamlFigureLengthSerializer.cs
- X509Certificate2Collection.cs
- xmlformatgeneratorstatics.cs
- CLSCompliantAttribute.cs
- Pts.cs
- HttpApplication.cs
- Rect.cs
- Polygon.cs
- GridViewSelectEventArgs.cs
- LayoutEvent.cs
- MessagePropertyDescriptionCollection.cs
- DoubleCollection.cs
- DataErrorValidationRule.cs
- BufferModeSettings.cs
- DateTimeOffsetConverter.cs
- PointLight.cs
- UserCancellationException.cs
- Native.cs
- NavigationHelper.cs
- SendActivityEventArgs.cs
- CommandHelpers.cs
- ClusterRegistryConfigurationProvider.cs
- TextRunCache.cs
- SparseMemoryStream.cs
- PathNode.cs
- LocalClientSecuritySettingsElement.cs
- ScriptHandlerFactory.cs
- TabControlDesigner.cs
- XmlTypeMapping.cs
- PtsCache.cs
- OneOfTypeConst.cs
- ArrayEditor.cs
- UIElementHelper.cs
- SessionPageStateSection.cs
- ItemContainerProviderWrapper.cs
- _TLSstream.cs
- QilDataSource.cs
- BooleanExpr.cs
- BindingBase.cs
- OleDbRowUpdatingEvent.cs
- OneOfScalarConst.cs
- Cursor.cs
- Pkcs7Recipient.cs
- SqlCachedBuffer.cs
- XmlSchemaValidationException.cs
- References.cs
- QuaternionConverter.cs
- SchemaHelper.cs
- HyperLinkDesigner.cs
- MembershipSection.cs
- DefinitionBase.cs
- ExtendedPropertyDescriptor.cs
- ImportContext.cs
- CollectionType.cs
- QuotedPairReader.cs
- AuthorizationSection.cs
- FlowDocumentScrollViewer.cs
- StrongNamePublicKeyBlob.cs
- AstNode.cs
- StrokeNodeEnumerator.cs
- AncillaryOps.cs
- OuterGlowBitmapEffect.cs
- ActiveXHost.cs
- Itemizer.cs
- GroupBox.cs
- SerializationInfo.cs
- AssociationSet.cs
- FamilyCollection.cs
- DescendantOverDescendantQuery.cs
- ValueOfAction.cs
- Trigger.cs
- WpfKnownMember.cs
- SelfIssuedAuthRSAPKCS1SignatureDeformatter.cs
- SiteIdentityPermission.cs
- SizeFConverter.cs