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
- XmlSchemaValidator.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- Menu.cs
- WindowsListViewSubItem.cs
- CodeDirectoryCompiler.cs
- Vector3DCollectionConverter.cs
- TextEditorThreadLocalStore.cs
- ChtmlPageAdapter.cs
- ResourceKey.cs
- DynamicValidator.cs
- RegularExpressionValidator.cs
- PartitionResolver.cs
- EventLog.cs
- CodeDomSerializerBase.cs
- ListItemCollection.cs
- XPathSelfQuery.cs
- ElementHostPropertyMap.cs
- SemanticValue.cs
- Int32Converter.cs
- MaskPropertyEditor.cs
- ObjectDataSourceSelectingEventArgs.cs
- DesignerValidatorAdapter.cs
- DetailsViewPageEventArgs.cs
- DBCommandBuilder.cs
- QilGenerator.cs
- XpsPackagingPolicy.cs
- Parser.cs
- ValidatedControlConverter.cs
- UnsafeNativeMethods.cs
- CodeIndexerExpression.cs
- TemplatedWizardStep.cs
- Rules.cs
- XmlWellformedWriter.cs
- localization.cs
- Configuration.cs
- StagingAreaInputItem.cs
- ApplicationFileCodeDomTreeGenerator.cs
- ViewStateException.cs
- ClientCultureInfo.cs
- DataColumnMapping.cs
- ProfileInfo.cs
- EntityContainerEmitter.cs
- XmlMemberMapping.cs
- MemberBinding.cs
- RtfControls.cs
- panel.cs
- BuildResult.cs
- NativeRecognizer.cs
- UIPermission.cs
- ToolStripPanel.cs
- OrderedDictionary.cs
- XmlSchemaObjectTable.cs
- ValidateNames.cs
- DbXmlEnabledProviderManifest.cs
- PostBackTrigger.cs
- LinqDataSourceContextEventArgs.cs
- DocumentCollection.cs
- CodePropertyReferenceExpression.cs
- XamlReaderHelper.cs
- SignatureToken.cs
- LineBreak.cs
- SystemColors.cs
- Authorization.cs
- IndentedWriter.cs
- HtmlControlPersistable.cs
- util.cs
- FragmentNavigationEventArgs.cs
- ToolStripSplitButton.cs
- OneWayElement.cs
- ImmutableDispatchRuntime.cs
- Pkcs9Attribute.cs
- MimeObjectFactory.cs
- MaterialCollection.cs
- CalendarKeyboardHelper.cs
- DataGridViewComboBoxEditingControl.cs
- CqlLexer.cs
- AutomationPatternInfo.cs
- ITextView.cs
- Int32CollectionValueSerializer.cs
- HttpStreams.cs
- AttributedMetaModel.cs
- DesignBinding.cs
- TextDecorationCollectionConverter.cs
- Sorting.cs
- CellParagraph.cs
- NumericUpDownAccelerationCollection.cs
- QuerySettings.cs
- UshortList2.cs
- FileSecurity.cs
- WebPartVerbCollection.cs
- ObjectQueryExecutionPlan.cs
- ModelItemKeyValuePair.cs
- ResolveNameEventArgs.cs
- SmiEventSink_Default.cs
- Crc32Helper.cs
- SafeCryptoHandles.cs
- DoubleAnimationUsingPath.cs
- CompiledQueryCacheKey.cs
- Privilege.cs
- CompilerCollection.cs