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
- SqlTypesSchemaImporter.cs
- IdentifierCollection.cs
- Part.cs
- ExpressionVisitor.cs
- ColorConvertedBitmapExtension.cs
- DelegateHelpers.cs
- GeneralTransformGroup.cs
- SqlCachedBuffer.cs
- BrowserCapabilitiesFactoryBase.cs
- oledbmetadatacollectionnames.cs
- ELinqQueryState.cs
- Number.cs
- DefaultDiscoveryServiceExtension.cs
- DataGridColumn.cs
- PassportAuthentication.cs
- Splitter.cs
- SchemaElementDecl.cs
- DiagnosticsConfigurationHandler.cs
- DataKey.cs
- ThreadAbortException.cs
- RTLAwareMessageBox.cs
- BufferModesCollection.cs
- CryptoHelper.cs
- GetPageCompletedEventArgs.cs
- PlaceHolder.cs
- RectIndependentAnimationStorage.cs
- EpmSyndicationContentSerializer.cs
- ProcessHostFactoryHelper.cs
- TemplatedAdorner.cs
- ParameterModifier.cs
- CheckBox.cs
- StrongNameIdentityPermission.cs
- FixedDocumentPaginator.cs
- Transactions.cs
- AspNetSynchronizationContext.cs
- ParameterBuilder.cs
- XmlQualifiedName.cs
- DocumentSequence.cs
- SqlBulkCopy.cs
- TextBoxAutoCompleteSourceConverter.cs
- MatrixAnimationUsingPath.cs
- LazyTextWriterCreator.cs
- PasswordBox.cs
- TraceInternal.cs
- ArrayItemValue.cs
- NamespaceCollection.cs
- EntitySqlQueryCacheKey.cs
- PolicyStatement.cs
- MouseEvent.cs
- HMACMD5.cs
- FlowDocumentPageViewerAutomationPeer.cs
- RunWorkerCompletedEventArgs.cs
- MyContact.cs
- OperandQuery.cs
- PropertyStore.cs
- ScrollBarRenderer.cs
- SafeNativeMethods.cs
- ConstraintCollection.cs
- DelayDesigner.cs
- DataServiceProviderWrapper.cs
- DomNameTable.cs
- mda.cs
- ConnectionManagementSection.cs
- AssemblyCache.cs
- SRDisplayNameAttribute.cs
- FilteredAttributeCollection.cs
- PathGeometry.cs
- ToolBarPanel.cs
- EncryptedReference.cs
- Speller.cs
- TableRowCollection.cs
- ThrowHelper.cs
- UnsafeNativeMethods.cs
- ZipIOLocalFileBlock.cs
- DispatcherTimer.cs
- Control.cs
- ObjectDataProvider.cs
- CompoundFileDeflateTransform.cs
- _RequestCacheProtocol.cs
- DictionaryGlobals.cs
- SafeFileMappingHandle.cs
- PaperSource.cs
- XmlSchemaSimpleContentExtension.cs
- TextBoxRenderer.cs
- Calendar.cs
- initElementDictionary.cs
- BindingsCollection.cs
- WebBodyFormatMessageProperty.cs
- Merger.cs
- XmlSchemaCollection.cs
- SecureStringHasher.cs
- WeakReference.cs
- ClientTarget.cs
- TimersDescriptionAttribute.cs
- ErrorWebPart.cs
- ConditionalAttribute.cs
- ErrorEventArgs.cs
- RayMeshGeometry3DHitTestResult.cs
- ToolStripDesignerUtils.cs
- DoubleLinkListEnumerator.cs