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
- GridProviderWrapper.cs
- WinHttpWebProxyFinder.cs
- __FastResourceComparer.cs
- ListViewItemEventArgs.cs
- ETagAttribute.cs
- GlobalProxySelection.cs
- EntityContainerEmitter.cs
- SynchronizedDispatch.cs
- FontSourceCollection.cs
- PseudoWebRequest.cs
- UrlAuthorizationModule.cs
- PlainXmlSerializer.cs
- DataGridBeginningEditEventArgs.cs
- SelectingProviderEventArgs.cs
- CustomErrorCollection.cs
- TypeLibConverter.cs
- XmlArrayAttribute.cs
- SizeIndependentAnimationStorage.cs
- Soap11ServerProtocol.cs
- FileDialogCustomPlaces.cs
- MessageDirection.cs
- DBCSCodePageEncoding.cs
- XmlnsCache.cs
- Collection.cs
- BrowserCapabilitiesCompiler.cs
- XsltArgumentList.cs
- RadioButtonList.cs
- AmbientLight.cs
- XmlSerializableReader.cs
- SplitterEvent.cs
- assertwrapper.cs
- DaylightTime.cs
- WebServiceData.cs
- Size3DValueSerializer.cs
- TableParaClient.cs
- BlurEffect.cs
- BaseCodePageEncoding.cs
- cache.cs
- PenThreadWorker.cs
- SqlUdtInfo.cs
- RoutedCommand.cs
- WebSysDefaultValueAttribute.cs
- SqlRecordBuffer.cs
- CryptoKeySecurity.cs
- ActivityContext.cs
- VisualBrush.cs
- SpeakProgressEventArgs.cs
- XmlParserContext.cs
- UidPropertyAttribute.cs
- ApplicationDirectory.cs
- OleDbParameter.cs
- PointAnimationUsingPath.cs
- Utils.cs
- SerialPort.cs
- SizeConverter.cs
- RegexWorker.cs
- XsltInput.cs
- TextRenderer.cs
- XmlDataFileEditor.cs
- DbXmlEnabledProviderManifest.cs
- SiteMapDataSource.cs
- DetailsViewModeEventArgs.cs
- DllHostedComPlusServiceHost.cs
- XmlSchemaGroupRef.cs
- FileCodeGroup.cs
- MetadataProperty.cs
- RepeaterItemEventArgs.cs
- EntityObject.cs
- StylusLogic.cs
- AdornedElementPlaceholder.cs
- Parallel.cs
- Timeline.cs
- DetailsViewPageEventArgs.cs
- RequestCachePolicy.cs
- ConstraintConverter.cs
- SqlDataAdapter.cs
- HttpRawResponse.cs
- MembershipValidatePasswordEventArgs.cs
- VisualStyleInformation.cs
- ConnectivityStatus.cs
- ViewValidator.cs
- HttpNamespaceReservationInstallComponent.cs
- OdbcConnectionPoolProviderInfo.cs
- StorageBasedPackageProperties.cs
- CodeSnippetCompileUnit.cs
- SmiEventSink.cs
- WorkflowDefinitionContext.cs
- IfElseDesigner.xaml.cs
- WebPartZoneBase.cs
- AppearanceEditorPart.cs
- SpellerError.cs
- WaitHandleCannotBeOpenedException.cs
- GeometryModel3D.cs
- Metafile.cs
- GenericEnumConverter.cs
- DotNetATv1WindowsLogEntrySerializer.cs
- ApplyImportsAction.cs
- FileVersionInfo.cs
- SubpageParaClient.cs
- ListBoxChrome.cs