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
- DateTime.cs
- _SpnDictionary.cs
- ComponentManagerBroker.cs
- UserPersonalizationStateInfo.cs
- EventLog.cs
- BamlTreeNode.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- PermissionRequestEvidence.cs
- Application.cs
- LoginUtil.cs
- DataBindingCollection.cs
- _NegoStream.cs
- SqlAliaser.cs
- NoClickablePointException.cs
- TextProviderWrapper.cs
- RequestStatusBarUpdateEventArgs.cs
- WebPartRestoreVerb.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- WorkflowTimerService.cs
- CacheSection.cs
- ValidatingPropertiesEventArgs.cs
- IgnoreFileBuildProvider.cs
- SafeThemeHandle.cs
- CodeIdentifier.cs
- OverflowException.cs
- PageSetupDialog.cs
- ColumnWidthChangedEvent.cs
- PolyQuadraticBezierSegment.cs
- DependencySource.cs
- SystemThemeKey.cs
- ObsoleteAttribute.cs
- CodeCommentStatement.cs
- SessionSwitchEventArgs.cs
- WSTransactionSection.cs
- _FixedSizeReader.cs
- AssemblyBuilder.cs
- SplayTreeNode.cs
- Effect.cs
- GiveFeedbackEvent.cs
- DesignerValidationSummaryAdapter.cs
- formatter.cs
- RegexWriter.cs
- WebServiceData.cs
- ObjectDataSourceMethodEventArgs.cs
- FileClassifier.cs
- ServiceModelReg.cs
- DataGridAddNewRow.cs
- ListControlDataBindingHandler.cs
- SqlGenerator.cs
- AttributeProviderAttribute.cs
- SafeProcessHandle.cs
- SqlDataRecord.cs
- SplitterEvent.cs
- Selection.cs
- EnumBuilder.cs
- AuthorizationSection.cs
- DynamicObjectAccessor.cs
- CookielessHelper.cs
- TrustManagerPromptUI.cs
- BaseValidator.cs
- HorizontalAlignConverter.cs
- XamlToRtfParser.cs
- EventManager.cs
- Permission.cs
- XmlSchemaException.cs
- ZipIOLocalFileHeader.cs
- RedistVersionInfo.cs
- BitHelper.cs
- ErrorStyle.cs
- RenameRuleObjectDialog.Designer.cs
- EllipseGeometry.cs
- JulianCalendar.cs
- WebPartDisplayModeCancelEventArgs.cs
- ListView.cs
- IApplicationTrustManager.cs
- TextDecorationCollection.cs
- arc.cs
- RangeValidator.cs
- ToolZone.cs
- AndAlso.cs
- AdobeCFFWrapper.cs
- DataGridViewDataErrorEventArgs.cs
- StrokeCollectionConverter.cs
- WeakHashtable.cs
- ParallelTimeline.cs
- QilTernary.cs
- formatter.cs
- ManipulationInertiaStartingEventArgs.cs
- MethodCallTranslator.cs
- CodeIdentifiers.cs
- BufferedGraphicsManager.cs
- TTSEngineTypes.cs
- DataGridViewButtonColumn.cs
- XmlSchemaAny.cs
- SqlRemoveConstantOrderBy.cs
- SerializationFieldInfo.cs
- XamlHttpHandlerFactory.cs
- RegisteredDisposeScript.cs
- CustomAttributeFormatException.cs
- HelpEvent.cs