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
- ToolboxItemFilterAttribute.cs
- Events.cs
- ReturnEventArgs.cs
- RubberbandSelector.cs
- CursorConverter.cs
- DataServiceRequestException.cs
- GroupBoxAutomationPeer.cs
- DrawingBrush.cs
- BindingOperations.cs
- FlowDocumentReaderAutomationPeer.cs
- SortQuery.cs
- MatrixKeyFrameCollection.cs
- SignatureHelper.cs
- DataRowView.cs
- SourceSwitch.cs
- ResXFileRef.cs
- AccessibilityHelperForVista.cs
- AppSecurityManager.cs
- GuidelineSet.cs
- OptimalTextSource.cs
- ListViewUpdatedEventArgs.cs
- SystemKeyConverter.cs
- ZipFileInfoCollection.cs
- ClientBuildManagerCallback.cs
- Stack.cs
- XamlFxTrace.cs
- TableCellAutomationPeer.cs
- FileDialogCustomPlace.cs
- PreloadedPackages.cs
- ComponentResourceKeyConverter.cs
- SemaphoreFullException.cs
- XmlNavigatorFilter.cs
- AudioStateChangedEventArgs.cs
- WindowsListViewSubItem.cs
- WebPartEditVerb.cs
- TextWriterTraceListener.cs
- MsmqIntegrationBinding.cs
- QEncodedStream.cs
- ButtonBase.cs
- SafeCancelMibChangeNotify.cs
- XmlAttributeOverrides.cs
- MemberAssignmentAnalysis.cs
- XmlDeclaration.cs
- ManifestSignedXml.cs
- InstanceOwner.cs
- HtmlEmptyTagControlBuilder.cs
- HttpBrowserCapabilitiesWrapper.cs
- ConstraintEnumerator.cs
- Point3DCollectionConverter.cs
- ErrorStyle.cs
- SQLBinary.cs
- GcHandle.cs
- XamlNamespaceHelper.cs
- controlskin.cs
- RepeatBehavior.cs
- EntityContainerRelationshipSet.cs
- LicenseException.cs
- WorkflowDefinitionDispenser.cs
- OpenTypeLayoutCache.cs
- DeclarativeCatalogPart.cs
- BuildManager.cs
- StructuralType.cs
- DateTimeConverter.cs
- RepeaterItemEventArgs.cs
- ReaderWriterLock.cs
- WebPartConnectionsDisconnectVerb.cs
- MemberCollection.cs
- ChildDocumentBlock.cs
- SafeNativeMethodsOther.cs
- PasswordTextContainer.cs
- URLString.cs
- ZipIOEndOfCentralDirectoryBlock.cs
- ChildTable.cs
- ApplicationTrust.cs
- TargetException.cs
- SortAction.cs
- FontStyles.cs
- OpCodes.cs
- figurelength.cs
- OdbcErrorCollection.cs
- ZipPackage.cs
- ServiceOperationWrapper.cs
- PropertyItem.cs
- PointAnimationClockResource.cs
- _FixedSizeReader.cs
- DesignerAutoFormat.cs
- DataServiceExpressionVisitor.cs
- NavigationPropertySingletonExpression.cs
- VisualCollection.cs
- PositiveTimeSpanValidator.cs
- WebHttpDispatchOperationSelector.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- ApplicationSecurityInfo.cs
- PropertyRecord.cs
- CheckedListBox.cs
- AssociationTypeEmitter.cs
- SignatureTargetIdManager.cs
- PathFigure.cs
- XmlILOptimizerVisitor.cs
- X509CertificateValidator.cs