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
- BrowserCapabilitiesFactoryBase.cs
- MsmqTransportSecurity.cs
- StylusButtonCollection.cs
- ConfigXmlWhitespace.cs
- ObjectIDGenerator.cs
- BitmapSource.cs
- FloaterBaseParaClient.cs
- AcceleratedTokenProvider.cs
- ColorConvertedBitmapExtension.cs
- CompositeDuplexBindingElement.cs
- TypeNameConverter.cs
- Cursor.cs
- DashStyle.cs
- ColumnReorderedEventArgs.cs
- DynamicMetaObject.cs
- BindMarkupExtensionSerializer.cs
- SessionStateModule.cs
- GeneralTransformGroup.cs
- ImageAnimator.cs
- InputLanguageManager.cs
- UrlPath.cs
- ToolboxItemFilterAttribute.cs
- WebMessageEncodingBindingElement.cs
- CollaborationHelperFunctions.cs
- CounterSample.cs
- ExpressionConverter.cs
- HtmlElementErrorEventArgs.cs
- DataMisalignedException.cs
- Serializer.cs
- _UriSyntax.cs
- AttachInfo.cs
- SecurityDescriptor.cs
- TreeChangeInfo.cs
- TextContainerChangeEventArgs.cs
- SequenceRangeCollection.cs
- BlurEffect.cs
- Expr.cs
- ExpressionConverter.cs
- AutomationPatternInfo.cs
- XmlWrappingWriter.cs
- InProcStateClientManager.cs
- WMICapabilities.cs
- RotateTransform3D.cs
- XmlAutoDetectWriter.cs
- DiscoveryOperationContextExtension.cs
- RoutingExtensionElement.cs
- TypeConverterHelper.cs
- HttpPostProtocolImporter.cs
- NumberFormatInfo.cs
- ParallelTimeline.cs
- MessageEnumerator.cs
- XmlUTF8TextReader.cs
- CompositeScriptReference.cs
- BadImageFormatException.cs
- Int32Rect.cs
- SqlCacheDependencyDatabase.cs
- InstanceContextMode.cs
- ClientConvert.cs
- DataServiceExpressionVisitor.cs
- _AutoWebProxyScriptWrapper.cs
- SuspendDesigner.cs
- ProfileSettingsCollection.cs
- TypedTableBaseExtensions.cs
- MetadataUtilsSmi.cs
- TextTreeObjectNode.cs
- EventHandlers.cs
- DragCompletedEventArgs.cs
- DataGridViewEditingControlShowingEventArgs.cs
- ProviderSettings.cs
- DataGridView.cs
- IncrementalReadDecoders.cs
- Collection.cs
- PocoEntityKeyStrategy.cs
- DesignObjectWrapper.cs
- AutoScrollHelper.cs
- ContentElement.cs
- OverlappedAsyncResult.cs
- ProfileSection.cs
- FixedSOMFixedBlock.cs
- UrlPath.cs
- HttpRawResponse.cs
- DragDeltaEventArgs.cs
- WebPartRestoreVerb.cs
- CompoundFileReference.cs
- ClipboardProcessor.cs
- MenuBindingsEditorForm.cs
- SqlException.cs
- Style.cs
- SelectionRangeConverter.cs
- ObjectMemberMapping.cs
- ProfileInfo.cs
- WindowsSecurityToken.cs
- TemplatedWizardStep.cs
- DbConnectionPoolIdentity.cs
- figurelengthconverter.cs
- SignedXml.cs
- MasterPage.cs
- bidPrivateBase.cs
- Activity.cs
- PageThemeBuildProvider.cs