Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- DataContractSerializerOperationBehavior.cs
- TypePropertyEditor.cs
- CookieParameter.cs
- Typeface.cs
- NativeWrapper.cs
- DataObjectSettingDataEventArgs.cs
- SessionStateModule.cs
- JsonServiceDocumentSerializer.cs
- StartUpEventArgs.cs
- CompModHelpers.cs
- DataSourceCollectionBase.cs
- PreloadHost.cs
- WindowsListViewGroupHelper.cs
- DbgCompiler.cs
- XmlSchemaRedefine.cs
- CompatibleComparer.cs
- SynchronizedKeyedCollection.cs
- NavigationProperty.cs
- CopyNamespacesAction.cs
- AddInBase.cs
- UpdateEventArgs.cs
- COM2EnumConverter.cs
- ValidatedControlConverter.cs
- CanExpandCollapseAllConverter.cs
- EditorPartChrome.cs
- PerformanceCounterNameAttribute.cs
- InstallerTypeAttribute.cs
- HtmlControlPersistable.cs
- WorkflowDefinitionContext.cs
- ViewStateModeByIdAttribute.cs
- Panel.cs
- SafeProcessHandle.cs
- IndexExpression.cs
- DesignerDataTable.cs
- CrossContextChannel.cs
- DateTimeConverter2.cs
- ItemCollection.cs
- ScriptReferenceBase.cs
- ConfigUtil.cs
- OleServicesContext.cs
- TextPattern.cs
- TraceInternal.cs
- SamlEvidence.cs
- XamlToRtfParser.cs
- UrlUtility.cs
- PublisherMembershipCondition.cs
- PipelineModuleStepContainer.cs
- ObjectHandle.cs
- EventLogEntryCollection.cs
- ErrorEventArgs.cs
- AccessText.cs
- SHA1Managed.cs
- Attributes.cs
- BuildProviderAppliesToAttribute.cs
- EntityRecordInfo.cs
- uribuilder.cs
- Trigger.cs
- ContractSearchPattern.cs
- DragStartedEventArgs.cs
- FileLogRecord.cs
- StorageComplexPropertyMapping.cs
- DataRelation.cs
- WindowCollection.cs
- ApplicationException.cs
- PreservationFileWriter.cs
- HttpsTransportBindingElement.cs
- CodeAttributeArgument.cs
- DesignerActionService.cs
- TextEditorThreadLocalStore.cs
- FlowDocumentPage.cs
- WebPartManager.cs
- ValidatorUtils.cs
- Helper.cs
- wgx_sdk_version.cs
- PageParserFilter.cs
- XmlnsDictionary.cs
- FixedFindEngine.cs
- ScriptReferenceEventArgs.cs
- ConnectionPoint.cs
- ConfigWriter.cs
- InfoCardBaseException.cs
- CollectionType.cs
- ProcessModelSection.cs
- OutputCacheSettingsSection.cs
- SqlDataSourceCache.cs
- InvalidAsynchronousStateException.cs
- TreeNodeEventArgs.cs
- itemelement.cs
- WindowsAuthenticationModule.cs
- ReferentialConstraint.cs
- TdsParserHelperClasses.cs
- SdlChannelSink.cs
- ButtonField.cs
- SchemaImporterExtensionElement.cs
- WrappedIUnknown.cs
- StateManagedCollection.cs
- DSACryptoServiceProvider.cs
- MediaContextNotificationWindow.cs
- OdbcEnvironment.cs
- AcceleratedTokenAuthenticator.cs