Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Configuration / System / Configuration / CallbackValidator.cs / 1 / 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
- TemplateNodeContextMenu.cs
- HandledEventArgs.cs
- PatternMatcher.cs
- BindingValueChangedEventArgs.cs
- XmlCollation.cs
- XPathException.cs
- TransactionState.cs
- DurableServiceAttribute.cs
- ManifestBasedResourceGroveler.cs
- MissingFieldException.cs
- DataBoundLiteralControl.cs
- PlatformCulture.cs
- Pkcs7Signer.cs
- Compiler.cs
- ScrollPatternIdentifiers.cs
- ContentPosition.cs
- DropTarget.cs
- HideDisabledControlAdapter.cs
- ParserHooks.cs
- Transform3DCollection.cs
- ListViewEditEventArgs.cs
- IndexingContentUnit.cs
- BitmapImage.cs
- TouchFrameEventArgs.cs
- ModelFactory.cs
- ProcessHostServerConfig.cs
- ForeignKeyConstraint.cs
- StandardBindingElementCollection.cs
- Image.cs
- NativeMethodsCLR.cs
- XPathSelectionIterator.cs
- ClientUtils.cs
- X509Certificate.cs
- BitmapVisualManager.cs
- MexBindingBindingCollectionElement.cs
- SubMenuStyleCollection.cs
- ComplexBindingPropertiesAttribute.cs
- BrowserCapabilitiesCodeGenerator.cs
- WebPageTraceListener.cs
- OleServicesContext.cs
- DebugView.cs
- MethodRental.cs
- CounterSampleCalculator.cs
- TreeView.cs
- Application.cs
- Simplifier.cs
- StrongNameKeyPair.cs
- RootBrowserWindowProxy.cs
- RoutedUICommand.cs
- WindowsMenu.cs
- PopupRoot.cs
- DatatypeImplementation.cs
- Int16Animation.cs
- EditingMode.cs
- InternalTypeHelper.cs
- NetworkCredential.cs
- RegexParser.cs
- CodeTypeDeclaration.cs
- HttpResponseBase.cs
- Int32Rect.cs
- TypeConverters.cs
- DataServiceException.cs
- WebPartCatalogCloseVerb.cs
- cache.cs
- IdentitySection.cs
- contentDescriptor.cs
- ArgIterator.cs
- PictureBoxDesigner.cs
- ToolStripMenuItemDesigner.cs
- ColorConvertedBitmap.cs
- CoreChannel.cs
- ReadWriteObjectLock.cs
- ImageSourceValueSerializer.cs
- DefaultAutoFieldGenerator.cs
- _FixedSizeReader.cs
- ToolStripPanelRow.cs
- ListenerElementsCollection.cs
- DataContext.cs
- FileLoadException.cs
- LayoutUtils.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- StatusBarPanelClickEvent.cs
- SpellerInterop.cs
- RequestTimeoutManager.cs
- OptionalColumn.cs
- InstanceCreationEditor.cs
- PageAsyncTask.cs
- WebPartConnectionsCloseVerb.cs
- OrderedDictionaryStateHelper.cs
- ButtonStandardAdapter.cs
- ImageDrawing.cs
- SqlDataSourceStatusEventArgs.cs
- DataListItemCollection.cs
- _DisconnectOverlappedAsyncResult.cs
- CompositeCollection.cs
- RequestResizeEvent.cs
- CultureInfo.cs
- TailCallAnalyzer.cs
- HtmlInputReset.cs
- DelegateTypeInfo.cs