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 / StringValidatorAttribute.cs / 1 / StringValidatorAttribute.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Configuration.Internal;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Security.Permissions;
using System.Xml;
using System.Globalization;
using System.ComponentModel;
using System.Security;
using System.Text;
namespace System.Configuration {
[AttributeUsage(AttributeTargets.Property)]
public sealed class StringValidatorAttribute : ConfigurationValidatorAttribute {
private int _minLength = 0;
private int _maxLength = int.MaxValue;
private string _invalidChars;
public StringValidatorAttribute() {
}
public override ConfigurationValidatorBase ValidatorInstance {
get {
return new StringValidator(_minLength, _maxLength, _invalidChars);
}
}
public int MinLength {
get {
return _minLength;
}
set {
if (_maxLength < value) {
throw new ArgumentOutOfRangeException("value", SR.GetString(SR.Validator_min_greater_than_max));
}
_minLength = value;
}
}
public int MaxLength {
get {
return _maxLength;
}
set {
if (_minLength > value) {
throw new ArgumentOutOfRangeException("value", SR.GetString(SR.Validator_min_greater_than_max));
}
_maxLength = value;
}
}
public string InvalidCharacters {
get {
return _invalidChars;
}
set {
_invalidChars = value;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Configuration.Internal;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Security.Permissions;
using System.Xml;
using System.Globalization;
using System.ComponentModel;
using System.Security;
using System.Text;
namespace System.Configuration {
[AttributeUsage(AttributeTargets.Property)]
public sealed class StringValidatorAttribute : ConfigurationValidatorAttribute {
private int _minLength = 0;
private int _maxLength = int.MaxValue;
private string _invalidChars;
public StringValidatorAttribute() {
}
public override ConfigurationValidatorBase ValidatorInstance {
get {
return new StringValidator(_minLength, _maxLength, _invalidChars);
}
}
public int MinLength {
get {
return _minLength;
}
set {
if (_maxLength < value) {
throw new ArgumentOutOfRangeException("value", SR.GetString(SR.Validator_min_greater_than_max));
}
_minLength = value;
}
}
public int MaxLength {
get {
return _maxLength;
}
set {
if (_minLength > value) {
throw new ArgumentOutOfRangeException("value", SR.GetString(SR.Validator_min_greater_than_max));
}
_maxLength = value;
}
}
public string InvalidCharacters {
get {
return _invalidChars;
}
set {
_invalidChars = 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
- CannotUnloadAppDomainException.cs
- HMACSHA256.cs
- EncoderParameter.cs
- ManagementObjectSearcher.cs
- PolyLineSegment.cs
- SchemaNames.cs
- CompilerGlobalScopeAttribute.cs
- ValidationEventArgs.cs
- ContainerParaClient.cs
- PageAsyncTaskManager.cs
- DataGridSortCommandEventArgs.cs
- HttpListenerResponse.cs
- Attributes.cs
- listitem.cs
- WorkflowFileItem.cs
- AdornerHitTestResult.cs
- GridViewColumn.cs
- HashAlgorithm.cs
- XPathAncestorQuery.cs
- EventProxy.cs
- MergeLocalizationDirectives.cs
- FormViewDeleteEventArgs.cs
- SchemaConstraints.cs
- IncrementalReadDecoders.cs
- RuntimeEnvironment.cs
- XmlSchemaProviderAttribute.cs
- ServiceSettingsResponseInfo.cs
- TransformDescriptor.cs
- FontNamesConverter.cs
- ServiceElementCollection.cs
- ApplicationServicesHostFactory.cs
- SoapServerMethod.cs
- HMACSHA384.cs
- DescendentsWalkerBase.cs
- ExternalFile.cs
- HtmlInputFile.cs
- AsymmetricKeyExchangeDeformatter.cs
- UIPermission.cs
- NullExtension.cs
- GCHandleCookieTable.cs
- TcpServerChannel.cs
- BamlRecords.cs
- HtmlAnchor.cs
- UnmanagedMarshal.cs
- AlignmentYValidation.cs
- UInt64Storage.cs
- SafeRightsManagementPubHandle.cs
- _HelperAsyncResults.cs
- DataGridViewButtonColumn.cs
- VariableQuery.cs
- TabControlEvent.cs
- SettingsProviderCollection.cs
- PriorityChain.cs
- EntryPointNotFoundException.cs
- ImageFormat.cs
- CallContext.cs
- TableLayoutPanelBehavior.cs
- OleDbDataAdapter.cs
- XmlSchemaExternal.cs
- CapabilitiesAssignment.cs
- UpWmlMobileTextWriter.cs
- SettingsPropertyWrongTypeException.cs
- RegexReplacement.cs
- GetWinFXPath.cs
- UIElementIsland.cs
- _LazyAsyncResult.cs
- SafeNativeMethodsCLR.cs
- SqlFunctionAttribute.cs
- StandardBindingImporter.cs
- DelegateBodyWriter.cs
- SourceChangedEventArgs.cs
- ListItemConverter.cs
- Perspective.cs
- AxParameterData.cs
- NavigationEventArgs.cs
- ReadOnlyHierarchicalDataSource.cs
- ToolStripSeparatorRenderEventArgs.cs
- AutoCompleteStringCollection.cs
- StdValidatorsAndConverters.cs
- linebase.cs
- UriScheme.cs
- DeploymentExceptionMapper.cs
- GenericParameterDataContract.cs
- BasicSecurityProfileVersion.cs
- propertyentry.cs
- MultiViewDesigner.cs
- ParallelTimeline.cs
- HostingEnvironmentSection.cs
- webproxy.cs
- FreezableOperations.cs
- DrawingAttributesDefaultValueFactory.cs
- RtfToken.cs
- PersonalizationProviderHelper.cs
- CommonObjectSecurity.cs
- MethodCallConverter.cs
- RoutedUICommand.cs
- DataObjectSettingDataEventArgs.cs
- DependencyObjectPropertyDescriptor.cs
- ProgressPage.cs
- DbSource.cs