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
- UnhandledExceptionEventArgs.cs
- ReadOnlyPropertyMetadata.cs
- SettingsProviderCollection.cs
- Panel.cs
- TableStyle.cs
- BitmapSource.cs
- RangeValuePatternIdentifiers.cs
- AuthenticationModulesSection.cs
- UserControlCodeDomTreeGenerator.cs
- StrongBox.cs
- Range.cs
- SR.cs
- FormatVersion.cs
- WebPageTraceListener.cs
- ToolTipAutomationPeer.cs
- QilVisitor.cs
- CngUIPolicy.cs
- PropertyPathWorker.cs
- ForeignConstraint.cs
- RegexCompilationInfo.cs
- FocusManager.cs
- RtfControlWordInfo.cs
- Point4D.cs
- RegisteredExpandoAttribute.cs
- SafeThreadHandle.cs
- WebMessageFormatHelper.cs
- WizardForm.cs
- TableRow.cs
- InputReportEventArgs.cs
- ImageSource.cs
- Misc.cs
- DataControlImageButton.cs
- RichTextBoxDesigner.cs
- ScriptReferenceBase.cs
- MetadataArtifactLoaderCompositeFile.cs
- EtwProvider.cs
- XmlSignatureManifest.cs
- UniqueEventHelper.cs
- StringUtil.cs
- RequestCacheManager.cs
- WebConfigurationManager.cs
- dataprotectionpermissionattribute.cs
- RoutedCommand.cs
- HtmlInputControl.cs
- StylusEventArgs.cs
- DesignerCategoryAttribute.cs
- recordstatefactory.cs
- StylusEventArgs.cs
- SettingsProviderCollection.cs
- GlyphRunDrawing.cs
- Int16AnimationUsingKeyFrames.cs
- RtfToken.cs
- SQLMoney.cs
- HttpListenerResponse.cs
- UIElement3D.cs
- CodeSnippetStatement.cs
- HttpStreamXmlDictionaryWriter.cs
- RenderDataDrawingContext.cs
- ListBoxItem.cs
- ToolbarAUtomationPeer.cs
- DiscriminatorMap.cs
- FixedSOMLineRanges.cs
- TextParaLineResult.cs
- Utils.cs
- ZipIOBlockManager.cs
- XMLSyntaxException.cs
- WorkflowServiceInstance.cs
- DuplicateWaitObjectException.cs
- TextDecorationCollectionConverter.cs
- EdmConstants.cs
- UdpTransportSettings.cs
- PointKeyFrameCollection.cs
- SqlError.cs
- DefaultValueTypeConverter.cs
- XmlSchemaCollection.cs
- Pool.cs
- ScriptHandlerFactory.cs
- GcHandle.cs
- DrawingBrush.cs
- Point4D.cs
- WindowsStatusBar.cs
- HWStack.cs
- ListSortDescriptionCollection.cs
- FontUnit.cs
- PolicyValidationException.cs
- ObjectQueryProvider.cs
- Section.cs
- ContainerParagraph.cs
- XmlBindingWorker.cs
- ComponentChangingEvent.cs
- CodeDomExtensionMethods.cs
- Options.cs
- SoapSchemaExporter.cs
- SqlStream.cs
- TextParaLineResult.cs
- DataGridViewCellStyle.cs
- PublisherMembershipCondition.cs
- XmlQualifiedNameTest.cs
- MessageQueue.cs
- InternalConfigHost.cs