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
- SettingsProperty.cs
- RuntimeHandles.cs
- Monitor.cs
- ConnectAlgorithms.cs
- WarningException.cs
- LoginName.cs
- ServiceModelActivationSectionGroup.cs
- HtmlInputText.cs
- ExitEventArgs.cs
- ProviderIncompatibleException.cs
- ControlIdConverter.cs
- exports.cs
- HostExecutionContextManager.cs
- ProcessThreadDesigner.cs
- RoutingEndpointTrait.cs
- ContainerParaClient.cs
- PreloadHost.cs
- FixUpCollection.cs
- PipelineModuleStepContainer.cs
- Attachment.cs
- CodeMemberField.cs
- EventSinkHelperWriter.cs
- RotateTransform3D.cs
- BitArray.cs
- TemplateKey.cs
- DataServiceStreamResponse.cs
- JobPageOrder.cs
- EncoderReplacementFallback.cs
- SoundPlayerAction.cs
- TransactionManager.cs
- Binding.cs
- ObjectDataSource.cs
- EmptyReadOnlyDictionaryInternal.cs
- Line.cs
- QilSortKey.cs
- _IPv4Address.cs
- Int16AnimationUsingKeyFrames.cs
- ToolZone.cs
- BitmapEffectDrawing.cs
- DeploymentExceptionMapper.cs
- XsdDataContractExporter.cs
- NameSpaceEvent.cs
- Atom10FeedFormatter.cs
- NonClientArea.cs
- unitconverter.cs
- CaseStatement.cs
- SimpleTypeResolver.cs
- Html32TextWriter.cs
- oledbconnectionstring.cs
- NetMsmqSecurity.cs
- PropertyPushdownHelper.cs
- TextContainerChangedEventArgs.cs
- Journal.cs
- MatrixValueSerializer.cs
- WindowsGraphicsCacheManager.cs
- ToolStripItemRenderEventArgs.cs
- UnmanagedMarshal.cs
- BitArray.cs
- Constraint.cs
- ListBase.cs
- WebPartConnectionsConnectVerb.cs
- ImportContext.cs
- XmlQueryStaticData.cs
- COAUTHIDENTITY.cs
- SafeCoTaskMem.cs
- BitmapEffectrendercontext.cs
- BuildResultCache.cs
- DataGridRowAutomationPeer.cs
- DataGridViewCellFormattingEventArgs.cs
- GraphicsContainer.cs
- EntityDataSourceMemberPath.cs
- DoubleLinkListEnumerator.cs
- HostingEnvironmentWrapper.cs
- XmlSchemaSimpleTypeRestriction.cs
- SelectorAutomationPeer.cs
- _NTAuthentication.cs
- ParameterModifier.cs
- SingleAnimationUsingKeyFrames.cs
- ReadOnlyActivityGlyph.cs
- UriScheme.cs
- UnsafeNativeMethods.cs
- StorageScalarPropertyMapping.cs
- WmlControlAdapter.cs
- Int32RectValueSerializer.cs
- HtmlGenericControl.cs
- HwndHostAutomationPeer.cs
- DbConvert.cs
- CharAnimationUsingKeyFrames.cs
- wgx_sdk_version.cs
- EventDescriptor.cs
- StrictModeSecurityHeaderElementInferenceEngine.cs
- ZipIORawDataFileBlock.cs
- ProgressBar.cs
- HijriCalendar.cs
- Transactions.cs
- XmlWriterSettings.cs
- HttpCachePolicyElement.cs
- CacheMode.cs
- SimpleRecyclingCache.cs
- DPTypeDescriptorContext.cs