Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- SwitchAttribute.cs
- namescope.cs
- WebPartCatalogCloseVerb.cs
- FocusChangedEventArgs.cs
- MemberJoinTreeNode.cs
- BrowserDefinitionCollection.cs
- ProcessThreadCollection.cs
- VersionPair.cs
- ImageUrlEditor.cs
- HtmlInputFile.cs
- WebServiceTypeData.cs
- FacetChecker.cs
- XmlSchemaException.cs
- Journaling.cs
- MouseButtonEventArgs.cs
- CompModSwitches.cs
- OverflowException.cs
- XmlWriter.cs
- LocalizableAttribute.cs
- TemplateModeChangedEventArgs.cs
- PropertyEmitter.cs
- IPPacketInformation.cs
- BamlRecordReader.cs
- InstanceDataCollection.cs
- GridViewSortEventArgs.cs
- DataGridViewCellMouseEventArgs.cs
- MachineKeySection.cs
- KeySplineConverter.cs
- DecimalKeyFrameCollection.cs
- TextHidden.cs
- ConfigurationManagerInternal.cs
- Logging.cs
- ListViewUpdatedEventArgs.cs
- JsonFormatGeneratorStatics.cs
- ConstraintCollection.cs
- StandardCommands.cs
- GridViewItemAutomationPeer.cs
- SignedXml.cs
- ProbeRequestResponseAsyncResult.cs
- HtmlButton.cs
- EmptyCollection.cs
- ProofTokenCryptoHandle.cs
- Pts.cs
- PrimitiveCodeDomSerializer.cs
- SQLInt64Storage.cs
- MinimizableAttributeTypeConverter.cs
- RowToFieldTransformer.cs
- DataGridViewImageColumn.cs
- MultiView.cs
- DictionaryBase.cs
- CategoryGridEntry.cs
- ContractCodeDomInfo.cs
- QueuedDeliveryRequirementsMode.cs
- TraceProvider.cs
- SqlBooleanizer.cs
- LexicalChunk.cs
- PngBitmapEncoder.cs
- AnimatedTypeHelpers.cs
- RemotingConfigParser.cs
- OutOfProcStateClientManager.cs
- brushes.cs
- AutomationEventArgs.cs
- IsolatedStorageFileStream.cs
- TemplateKey.cs
- FtpWebResponse.cs
- EmissiveMaterial.cs
- CoreSwitches.cs
- ExtractorMetadata.cs
- SendActivityDesignerTheme.cs
- Point.cs
- ClientSideProviderDescription.cs
- AuthorizationPolicyTypeElementCollection.cs
- X509ChainElement.cs
- DataRecordInternal.cs
- OperationAbortedException.cs
- PropertyBuilder.cs
- MissingManifestResourceException.cs
- DataListAutoFormat.cs
- InstanceDataCollection.cs
- NamedPipeTransportElement.cs
- BaseProcessor.cs
- ConcurrencyBehavior.cs
- ShowExpandedMultiValueConverter.cs
- XmlReaderSettings.cs
- VisualStyleInformation.cs
- _LocalDataStoreMgr.cs
- ParamArrayAttribute.cs
- TypeName.cs
- InternalResources.cs
- AxisAngleRotation3D.cs
- Exceptions.cs
- UpdateExpressionVisitor.cs
- StylusPoint.cs
- AutoResetEvent.cs
- TextSpanModifier.cs
- UIElementParagraph.cs
- ToolStripComboBox.cs
- ProfileGroupSettingsCollection.cs
- HttpDebugHandler.cs
- MouseEventArgs.cs