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
- ReachPageContentCollectionSerializerAsync.cs
- SafeNativeMethods.cs
- DataGridViewRowsRemovedEventArgs.cs
- MachineKeySection.cs
- NeutralResourcesLanguageAttribute.cs
- CodeAttributeArgument.cs
- TimeSpanFormat.cs
- Helper.cs
- ConnectionManagementElement.cs
- CompositeActivityValidator.cs
- PropertySet.cs
- entitydatasourceentitysetnameconverter.cs
- COM2FontConverter.cs
- EditableTreeList.cs
- PathGeometry.cs
- loginstatus.cs
- CodeCastExpression.cs
- Base64Stream.cs
- MatrixIndependentAnimationStorage.cs
- ZoneButton.cs
- Set.cs
- XmlMemberMapping.cs
- localization.cs
- SHA1Managed.cs
- NavigationService.cs
- CustomAttributeSerializer.cs
- AppDomainEvidenceFactory.cs
- ADConnectionHelper.cs
- FloatUtil.cs
- KnownTypesHelper.cs
- XmlStreamStore.cs
- ListBoxItem.cs
- SqlCharStream.cs
- ValueProviderWrapper.cs
- SmtpFailedRecipientException.cs
- DirtyTextRange.cs
- TypeExtensionConverter.cs
- BoundColumn.cs
- DBParameter.cs
- WebPartMenuStyle.cs
- Attributes.cs
- DrawItemEvent.cs
- Win32Native.cs
- CompilationLock.cs
- SkipStoryboardToFill.cs
- ResourceWriter.cs
- SqlMetaData.cs
- ProfileBuildProvider.cs
- HiddenField.cs
- BaseTemplateBuildProvider.cs
- COM2IDispatchConverter.cs
- OdbcStatementHandle.cs
- MessageBox.cs
- ReferenceAssemblyAttribute.cs
- OuterProxyWrapper.cs
- TimeZone.cs
- CorrelationScope.cs
- TraceUtils.cs
- MultiPageTextView.cs
- ExtensionDataObject.cs
- MenuRendererClassic.cs
- BitmapDownload.cs
- ResourceProviderFactory.cs
- XmlNodeChangedEventManager.cs
- TraceXPathNavigator.cs
- IDispatchConstantAttribute.cs
- BitmapCacheBrush.cs
- TrustLevelCollection.cs
- COSERVERINFO.cs
- RuleInfoComparer.cs
- PlainXmlSerializer.cs
- SmiConnection.cs
- TokenFactoryFactory.cs
- WebReferenceOptions.cs
- ObjectQuery_EntitySqlExtensions.cs
- ConfigurationElementCollection.cs
- ReachDocumentReferenceCollectionSerializerAsync.cs
- ThreadStateException.cs
- ZoneLinkButton.cs
- Timeline.cs
- Math.cs
- BaseTemplateBuildProvider.cs
- securestring.cs
- Crc32.cs
- PropertyInfoSet.cs
- BorderGapMaskConverter.cs
- Pointer.cs
- Duration.cs
- AssociationSetEnd.cs
- NavigationWindow.cs
- ControlCollection.cs
- SimpleApplicationHost.cs
- Ops.cs
- GlyphRun.cs
- RenderTargetBitmap.cs
- ReverseQueryOperator.cs
- HttpApplication.cs
- DataControlReferenceCollection.cs
- BinaryUtilClasses.cs
- _SSPIWrapper.cs