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
- GenericAuthenticationEventArgs.cs
- AddingNewEventArgs.cs
- Crc32Helper.cs
- DisplayToken.cs
- XmlAttributeCollection.cs
- SafeProcessHandle.cs
- TypefaceCollection.cs
- documentsequencetextview.cs
- SizeKeyFrameCollection.cs
- StorageEndPropertyMapping.cs
- ResourceReferenceKeyNotFoundException.cs
- SqlColumnizer.cs
- PropertyManager.cs
- UIHelper.cs
- QuaternionAnimationUsingKeyFrames.cs
- WebBrowserNavigatingEventHandler.cs
- ToolboxItemWrapper.cs
- securestring.cs
- ProjectionPathSegment.cs
- CommandHelper.cs
- SynchronizedInputPattern.cs
- VBIdentifierTrimConverter.cs
- TextBox.cs
- Pen.cs
- SemanticTag.cs
- SqlXmlStorage.cs
- DataSetSchema.cs
- ThreadBehavior.cs
- XamlFigureLengthSerializer.cs
- TransactionChannelListener.cs
- XPathBuilder.cs
- webproxy.cs
- DataMisalignedException.cs
- SourceFileInfo.cs
- ChtmlPhoneCallAdapter.cs
- TextTreeDeleteContentUndoUnit.cs
- CultureData.cs
- Formatter.cs
- DisplayClaim.cs
- DataObjectCopyingEventArgs.cs
- LineServicesRun.cs
- FixedTextPointer.cs
- InternalCache.cs
- CopyOnWriteList.cs
- ContextMenuService.cs
- DrawingCollection.cs
- SqlXmlStorage.cs
- GatewayDefinition.cs
- DecimalStorage.cs
- HierarchicalDataBoundControl.cs
- GlyphingCache.cs
- XmlHierarchicalDataSourceView.cs
- CompilerLocalReference.cs
- AstTree.cs
- CompositeCollection.cs
- X509Certificate2Collection.cs
- HtmlHead.cs
- Expression.cs
- EntityContainer.cs
- ExpressionBinding.cs
- WmlLiteralTextAdapter.cs
- ClientUrlResolverWrapper.cs
- ObjectDataSourceDisposingEventArgs.cs
- SqlDataSource.cs
- OdbcRowUpdatingEvent.cs
- DecimalConverter.cs
- ProfileSection.cs
- LicFileLicenseProvider.cs
- PolyQuadraticBezierSegment.cs
- XmlSerializerVersionAttribute.cs
- ScrollChrome.cs
- XamlSerializationHelper.cs
- UnmanagedMarshal.cs
- SafeEventHandle.cs
- CaretElement.cs
- BuilderPropertyEntry.cs
- ClickablePoint.cs
- SiteMembershipCondition.cs
- QuaternionRotation3D.cs
- OSEnvironmentHelper.cs
- DataBindingExpressionBuilder.cs
- ITreeGenerator.cs
- NumberFunctions.cs
- CssTextWriter.cs
- ValueChangedEventManager.cs
- RotateTransform3D.cs
- SqlStatistics.cs
- LightweightCodeGenerator.cs
- ToolStripSettings.cs
- DataSourceCache.cs
- ImportOptions.cs
- autovalidator.cs
- NativeObjectSecurity.cs
- SimpleFieldTemplateUserControl.cs
- StrongNameKeyPair.cs
- FileInfo.cs
- PageFunction.cs
- WebBrowserNavigatedEventHandler.cs
- ItemCheckedEvent.cs
- FakeModelItemImpl.cs