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
- LinqDataSourceDeleteEventArgs.cs
- ToolStripDesignerUtils.cs
- EntityDataSourceWrapperCollection.cs
- BitmapEffectState.cs
- Opcode.cs
- BitmapEffectDrawingContextState.cs
- wgx_render.cs
- InputLangChangeEvent.cs
- VSWCFServiceContractGenerator.cs
- RubberbandSelector.cs
- WebHttpBinding.cs
- login.cs
- HttpHandlersSection.cs
- TypeBuilder.cs
- WorkItem.cs
- AsyncResult.cs
- CustomGrammar.cs
- MissingMemberException.cs
- SchemeSettingElement.cs
- LinearGradientBrush.cs
- TableLayout.cs
- FontFamilyIdentifier.cs
- TextPenaltyModule.cs
- BinaryUtilClasses.cs
- SendMessageChannelCache.cs
- CodeLabeledStatement.cs
- BitmapEffectRenderDataResource.cs
- DNS.cs
- PointAnimationUsingPath.cs
- XmlWrappingReader.cs
- Schema.cs
- HoistedLocals.cs
- IdentityReference.cs
- Grid.cs
- SecurityMode.cs
- InputProcessorProfilesLoader.cs
- ValidateNames.cs
- ActivityUtilities.cs
- TreeView.cs
- PermissionToken.cs
- _HeaderInfo.cs
- ScriptResourceInfo.cs
- TypeGeneratedEventArgs.cs
- BitConverter.cs
- MissingMemberException.cs
- WSSecurityOneDotOneReceiveSecurityHeader.cs
- Transactions.cs
- XAMLParseException.cs
- XmlDataSourceNodeDescriptor.cs
- HandleCollector.cs
- BuildManager.cs
- InvalidStoreProtectionKeyException.cs
- GenerateTemporaryTargetAssembly.cs
- ErrorHandlerModule.cs
- RegisteredDisposeScript.cs
- DataListItemCollection.cs
- PackageRelationship.cs
- PassportAuthentication.cs
- ReflectionPermission.cs
- AngleUtil.cs
- PropertyTab.cs
- OdbcRowUpdatingEvent.cs
- ObjectTag.cs
- ClientType.cs
- ConfigXmlWhitespace.cs
- TypeInitializationException.cs
- SplineKeyFrames.cs
- DbConnectionInternal.cs
- ValidationSettings.cs
- PanelStyle.cs
- PageAsyncTaskManager.cs
- PrintDialog.cs
- ToolTipService.cs
- MergeLocalizationDirectives.cs
- PointHitTestResult.cs
- CatalogPartCollection.cs
- MessageEncoder.cs
- WindowsFormsLinkLabel.cs
- FileDialog_Vista_Interop.cs
- BindingCollection.cs
- ProtocolsConfigurationHandler.cs
- ToolBar.cs
- BindingManagerDataErrorEventArgs.cs
- ExceptionHelpers.cs
- CodeSnippetCompileUnit.cs
- TextEditor.cs
- PropertyPathWorker.cs
- ContentType.cs
- DataExchangeServiceBinder.cs
- GenericTypeParameterConverter.cs
- Stack.cs
- PolygonHotSpot.cs
- TableDetailsRow.cs
- SqlTriggerContext.cs
- _DisconnectOverlappedAsyncResult.cs
- EdmValidator.cs
- Typography.cs
- CfgSemanticTag.cs
- DisplayInformation.cs
- Pair.cs