Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / CallbackValidator.cs / 1305376 / CallbackValidator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Collections.Specialized; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; using System.Text.RegularExpressions; namespace System.Configuration { public sealed class CallbackValidator : ConfigurationValidatorBase { Type _type; ValidatorCallback _callback; public CallbackValidator(Type type, ValidatorCallback callback) : this(callback) { if (type == null) { throw new ArgumentNullException("type"); } _type = type; } // Do not check for null type here to handle the callback attribute case internal CallbackValidator(ValidatorCallback callback) { if (callback == null) { throw new ArgumentNullException("callback"); } _type = null; _callback = callback; } public override bool CanValidate(Type type) { return (type == _type || _type == null); } public override void Validate(object value) { _callback(value); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Xml; using System.Collections.Specialized; using System.Globalization; using System.ComponentModel; using System.Security; using System.Text; using System.Text.RegularExpressions; namespace System.Configuration { public sealed class CallbackValidator : ConfigurationValidatorBase { Type _type; ValidatorCallback _callback; public CallbackValidator(Type type, ValidatorCallback callback) : this(callback) { if (type == null) { throw new ArgumentNullException("type"); } _type = type; } // Do not check for null type here to handle the callback attribute case internal CallbackValidator(ValidatorCallback callback) { if (callback == null) { throw new ArgumentNullException("callback"); } _type = null; _callback = callback; } public override bool CanValidate(Type type) { return (type == _type || _type == null); } public override void Validate(object value) { _callback(value); } } } // 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
- HitTestWithGeometryDrawingContextWalker.cs
- BinaryMethodMessage.cs
- WebPartTransformerCollection.cs
- ConnectorRouter.cs
- GridItemProviderWrapper.cs
- mactripleDES.cs
- ProtocolReflector.cs
- UIElementCollection.cs
- OciHandle.cs
- ClaimComparer.cs
- PatternMatcher.cs
- StackOverflowException.cs
- SafeLocalMemHandle.cs
- DataContractSerializerFaultFormatter.cs
- ApplyTemplatesAction.cs
- CultureTableRecord.cs
- FloaterBaseParagraph.cs
- PointIndependentAnimationStorage.cs
- DependencyPropertyChangedEventArgs.cs
- SetterBaseCollection.cs
- ImageSource.cs
- DataGridColumn.cs
- SafeSecurityHandles.cs
- XmlCDATASection.cs
- StyleTypedPropertyAttribute.cs
- UncommonField.cs
- WorkflowCompensationBehavior.cs
- Speller.cs
- SessionStateSection.cs
- DrawingContextDrawingContextWalker.cs
- EventProviderClassic.cs
- ObsoleteAttribute.cs
- MsmqIntegrationChannelListener.cs
- ExceptionWrapper.cs
- DisplayInformation.cs
- ItemCollection.cs
- Label.cs
- SchemaTableOptionalColumn.cs
- CryptoApi.cs
- RectAnimationBase.cs
- DebugViewWriter.cs
- TempEnvironment.cs
- TrustManager.cs
- Knowncolors.cs
- ToolStripHighContrastRenderer.cs
- DbMetaDataColumnNames.cs
- NavigationProperty.cs
- DrawingContext.cs
- SerialPort.cs
- XPathDocumentBuilder.cs
- ViewgenGatekeeper.cs
- RuntimeVariablesExpression.cs
- CommonDialog.cs
- ThaiBuddhistCalendar.cs
- webeventbuffer.cs
- IntegrationExceptionEventArgs.cs
- GridViewColumn.cs
- RuntimeResourceSet.cs
- BindingElementExtensionElement.cs
- ObjectQuery.cs
- ThreadStartException.cs
- TextRangeEditLists.cs
- ColumnTypeConverter.cs
- VisualTreeHelper.cs
- __ComObject.cs
- XPathMultyIterator.cs
- SponsorHelper.cs
- DirectoryNotFoundException.cs
- KnownBoxes.cs
- PaperSource.cs
- ChangeDirector.cs
- ListArgumentProvider.cs
- AssemblyAttributes.cs
- DesignTimeParseData.cs
- ToolStripContentPanelDesigner.cs
- ScriptManager.cs
- ResumeStoryboard.cs
- PolyQuadraticBezierSegment.cs
- SendMailErrorEventArgs.cs
- StandardCommandToolStripMenuItem.cs
- DataGridColumnReorderingEventArgs.cs
- OleStrCAMarshaler.cs
- RepeaterItemEventArgs.cs
- MonikerUtility.cs
- XmlAttributeAttribute.cs
- EditorPartCollection.cs
- ConstrainedDataObject.cs
- FolderNameEditor.cs
- QuarticEase.cs
- NameSpaceExtractor.cs
- JsonGlobals.cs
- FlowThrottle.cs
- KoreanCalendar.cs
- MailFileEditor.cs
- ProvideValueServiceProvider.cs
- DataServiceQueryProvider.cs
- RegistrySecurity.cs
- WebRequestModuleElement.cs
- LinqDataSourceStatusEventArgs.cs
- DynamicPropertyHolder.cs