Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- CodeSnippetExpression.cs
- DataGridViewAdvancedBorderStyle.cs
- ProcessModelInfo.cs
- CoreChannel.cs
- Substitution.cs
- BitStack.cs
- ConnectorSelectionGlyph.cs
- SerializableAttribute.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- Attributes.cs
- ScalarOps.cs
- RawUIStateInputReport.cs
- ProxyGenerator.cs
- PersonalizationStateQuery.cs
- SafeNativeMemoryHandle.cs
- XmlRootAttribute.cs
- SqlCrossApplyToCrossJoin.cs
- ConfigXmlElement.cs
- SqlBooleanizer.cs
- UriPrefixTable.cs
- FormatterServices.cs
- JsonDeserializer.cs
- Transform.cs
- TableItemStyle.cs
- Menu.cs
- StandardBindingImporter.cs
- DataListItemEventArgs.cs
- CalendarDay.cs
- HuffCodec.cs
- SystemFonts.cs
- LineGeometry.cs
- Image.cs
- SafeProcessHandle.cs
- NavigateEvent.cs
- Compiler.cs
- LayoutDump.cs
- MsmqAppDomainProtocolHandler.cs
- ClientScriptItem.cs
- QueryableDataSourceHelper.cs
- loginstatus.cs
- UserControlParser.cs
- SingleAnimation.cs
- TraceSection.cs
- TextFormatterContext.cs
- XmlReflectionMember.cs
- TableLayoutCellPaintEventArgs.cs
- SQLBinary.cs
- SqlTypeConverter.cs
- BamlMapTable.cs
- MessageBox.cs
- TextReader.cs
- EventlogProvider.cs
- HttpProfileBase.cs
- StaticExtension.cs
- Int64Storage.cs
- Camera.cs
- ReflectionTypeLoadException.cs
- TraceContextRecord.cs
- FullTextLine.cs
- XslCompiledTransform.cs
- StrongNameIdentityPermission.cs
- DataGridCaption.cs
- DataPagerFieldItem.cs
- ResXResourceReader.cs
- XmlSchemaImport.cs
- ReadOnlyMetadataCollection.cs
- PinnedBufferMemoryStream.cs
- HotSpotCollectionEditor.cs
- XamlSerializer.cs
- DataServiceProcessingPipeline.cs
- EqualityComparer.cs
- AsyncPostBackErrorEventArgs.cs
- X509Certificate2.cs
- BamlTreeMap.cs
- GroupPartitionExpr.cs
- Psha1DerivedKeyGenerator.cs
- UnmanagedHandle.cs
- DbCommandTree.cs
- GradientBrush.cs
- ObjectListCommandsPage.cs
- SoapEnumAttribute.cs
- SafeCertificateStore.cs
- PageContentCollection.cs
- WebHostScriptMappingsInstallComponent.cs
- InvalidContentTypeException.cs
- CannotUnloadAppDomainException.cs
- PassportAuthenticationModule.cs
- arc.cs
- AvtEvent.cs
- StylusButtonEventArgs.cs
- BuildProviderAppliesToAttribute.cs
- RegistryKey.cs
- CodeIdentifiers.cs
- _LazyAsyncResult.cs
- SafePEFileHandle.cs
- ClonableStack.cs
- MiniLockedBorderGlyph.cs
- AssertSection.cs
- XmlSchemaExternal.cs
- PropertyDescriptorCollection.cs