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
- FieldToken.cs
- ParameterCollectionEditor.cs
- SettingsPropertyNotFoundException.cs
- RequestValidator.cs
- ListViewContainer.cs
- ColumnResizeUndoUnit.cs
- WorkflowQueue.cs
- RepeatBehavior.cs
- NotifyParentPropertyAttribute.cs
- EnumerableRowCollection.cs
- GZipStream.cs
- DataSet.cs
- HttpProfileBase.cs
- CustomSignedXml.cs
- TreeViewImageKeyConverter.cs
- CharUnicodeInfo.cs
- HttpListenerElement.cs
- XmlWriterSettings.cs
- CodeTryCatchFinallyStatement.cs
- MenuEventArgs.cs
- Window.cs
- ContentElementAutomationPeer.cs
- AnchoredBlock.cs
- PointCollectionConverter.cs
- oledbmetadatacollectionnames.cs
- BrushProxy.cs
- OleServicesContext.cs
- SvcMapFileLoader.cs
- ConversionContext.cs
- MemberRestriction.cs
- DataObjectCopyingEventArgs.cs
- invalidudtexception.cs
- BamlLocalizer.cs
- GridItemCollection.cs
- SetterBase.cs
- ValueUnavailableException.cs
- LineBreak.cs
- SafeHandles.cs
- DebugTracing.cs
- ItemCollection.cs
- RadioButtonAutomationPeer.cs
- MSAANativeProvider.cs
- Errors.cs
- SelectionEditingBehavior.cs
- TreeNodeConverter.cs
- DynamicValidator.cs
- Mouse.cs
- RenderCapability.cs
- MarshalByRefObject.cs
- ThreadStaticAttribute.cs
- SyntaxCheck.cs
- SharedPersonalizationStateInfo.cs
- CompilerCollection.cs
- PropertyGridCommands.cs
- SQLDoubleStorage.cs
- IdleTimeoutMonitor.cs
- HttpHeaderCollection.cs
- UdpConstants.cs
- ConvertersCollection.cs
- DeploymentSection.cs
- StatusBarPanel.cs
- WebRequest.cs
- WebConfigurationHostFileChange.cs
- XmlSchemaImporter.cs
- RawStylusActions.cs
- IgnoreDataMemberAttribute.cs
- NavigationHelper.cs
- RelatedEnd.cs
- EventLogPermissionEntry.cs
- Internal.cs
- SafeProcessHandle.cs
- PointLight.cs
- DetailsView.cs
- Image.cs
- SymDocumentType.cs
- TableItemStyle.cs
- EraserBehavior.cs
- NameTable.cs
- AnimationException.cs
- InternalControlCollection.cs
- CapabilitiesPattern.cs
- TimerElapsedEvenArgs.cs
- PlanCompiler.cs
- ProvidersHelper.cs
- ObjectDataSourceView.cs
- MbpInfo.cs
- OdbcErrorCollection.cs
- RectangleConverter.cs
- X509RawDataKeyIdentifierClause.cs
- GeneratedView.cs
- TargetParameterCountException.cs
- ZipIOCentralDirectoryFileHeader.cs
- TextBlockAutomationPeer.cs
- AsyncCodeActivity.cs
- ObjectSecurity.cs
- PenThreadPool.cs
- InternalControlCollection.cs
- ValidationRuleCollection.cs
- MsmqDecodeHelper.cs
- StringDictionaryCodeDomSerializer.cs