Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Configuration / System / Configuration / StringValidatorAttribute.cs / 1305376 / 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
- SplitterEvent.cs
- ObsoleteAttribute.cs
- UnsafeNativeMethods.cs
- ContentFileHelper.cs
- LZCodec.cs
- DependencyObject.cs
- OrderedDictionary.cs
- TextRangeAdaptor.cs
- TemplatePagerField.cs
- SiteMapNodeCollection.cs
- Sorting.cs
- Random.cs
- X509SecurityTokenProvider.cs
- NeutralResourcesLanguageAttribute.cs
- PropertyChangingEventArgs.cs
- AdjustableArrowCap.cs
- InteropBitmapSource.cs
- DataViewSettingCollection.cs
- CodeTypeOfExpression.cs
- ServicePointManager.cs
- XsdDataContractExporter.cs
- WebResourceAttribute.cs
- PathSegment.cs
- TemplateControl.cs
- ExecutedRoutedEventArgs.cs
- CodeGotoStatement.cs
- HttpClientCertificate.cs
- FontResourceCache.cs
- SqlNodeTypeOperators.cs
- Control.cs
- ControlParameter.cs
- SafeHandle.cs
- WebRequest.cs
- OdbcEnvironment.cs
- OptimizerPatterns.cs
- TextCompositionEventArgs.cs
- RecognizedPhrase.cs
- ReflectionUtil.cs
- Rss20FeedFormatter.cs
- ConfigsHelper.cs
- bidPrivateBase.cs
- WindowsEditBoxRange.cs
- Metadata.cs
- SQLByteStorage.cs
- SafeEventLogReadHandle.cs
- InternalResources.cs
- TextServicesPropertyRanges.cs
- ResolveMatchesCD1.cs
- X509ChainPolicy.cs
- GridItem.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- SettingsAttributes.cs
- LambdaCompiler.Address.cs
- XPathAxisIterator.cs
- BamlLocalizableResourceKey.cs
- Environment.cs
- AssemblyResourceLoader.cs
- TemplateBindingExtensionConverter.cs
- PersonalizationDictionary.cs
- AutoFocusStyle.xaml.cs
- ExpressionBinding.cs
- DocumentScope.cs
- NullableIntMinMaxAggregationOperator.cs
- SelectionHighlightInfo.cs
- Merger.cs
- MemoryResponseElement.cs
- ManifestResourceInfo.cs
- FolderNameEditor.cs
- SectionInput.cs
- RuleEngine.cs
- SchemaSetCompiler.cs
- baseshape.cs
- DbDataSourceEnumerator.cs
- DetailsViewRow.cs
- DBParameter.cs
- HostExecutionContextManager.cs
- odbcmetadatafactory.cs
- ScriptServiceAttribute.cs
- SmiRecordBuffer.cs
- Comparer.cs
- GenericIdentity.cs
- SiteMapProvider.cs
- WindowsToolbar.cs
- XmlSchemaSimpleContent.cs
- AppearanceEditorPart.cs
- TextEffect.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- RequestCacheValidator.cs
- ChannelManager.cs
- MaskedTextBoxTextEditor.cs
- StorageComplexTypeMapping.cs
- TextSelectionHighlightLayer.cs
- EntityDataSourceSelectingEventArgs.cs
- HierarchicalDataSourceConverter.cs
- PlanCompiler.cs
- XmlValidatingReader.cs
- Line.cs
- BitmapEffect.cs
- Query.cs
- XamlInt32CollectionSerializer.cs