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
- FrameworkElement.cs
- WebBrowserSiteBase.cs
- CookielessHelper.cs
- ValidationRule.cs
- PropertyDescriptorCollection.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- DesignerLoader.cs
- PreviewKeyDownEventArgs.cs
- TransformCollection.cs
- NamedPipeProcessProtocolHandler.cs
- SelectionRange.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- Keywords.cs
- PrimitiveSchema.cs
- DataGridItemAttachedStorage.cs
- TimeZoneNotFoundException.cs
- IImplicitResourceProvider.cs
- PixelFormatConverter.cs
- ProbeMatchesApril2005.cs
- WsatAdminException.cs
- ElementUtil.cs
- EventDescriptor.cs
- SqlDuplicator.cs
- ListDataBindEventArgs.cs
- SecurityChannel.cs
- WmlMobileTextWriter.cs
- mansign.cs
- HttpResponseHeader.cs
- TextTreeInsertUndoUnit.cs
- NameScope.cs
- PerfService.cs
- KeyedHashAlgorithm.cs
- ConfigurationValues.cs
- AnimationClock.cs
- EasingKeyFrames.cs
- EvidenceTypeDescriptor.cs
- UnescapedXmlDiagnosticData.cs
- StyleSelector.cs
- EventLogHandle.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- XmlText.cs
- ThicknessConverter.cs
- BindingNavigator.cs
- WebEvents.cs
- FileAuthorizationModule.cs
- Vars.cs
- VariableQuery.cs
- ConfigurationValues.cs
- OdbcError.cs
- DocumentPageTextView.cs
- MasterPageParser.cs
- LinqMaximalSubtreeNominator.cs
- DoWorkEventArgs.cs
- XmlTextReaderImpl.cs
- ScopeCollection.cs
- COM2Properties.cs
- FormatterConverter.cs
- BadImageFormatException.cs
- PriorityItem.cs
- HebrewCalendar.cs
- login.cs
- DataViewManager.cs
- WebHttpSecurityElement.cs
- DataSourceXmlAttributeAttribute.cs
- AdornerLayer.cs
- SaveFileDialog.cs
- X500Name.cs
- SortExpressionBuilder.cs
- RectConverter.cs
- PkcsMisc.cs
- LineServicesRun.cs
- CodeTypeDeclaration.cs
- DataViewManagerListItemTypeDescriptor.cs
- RadioButtonFlatAdapter.cs
- QilInvoke.cs
- SecureConversationSecurityTokenParameters.cs
- AutomationPropertyInfo.cs
- HttpConfigurationContext.cs
- TextSpanModifier.cs
- AnonymousIdentificationSection.cs
- InputLanguage.cs
- TransformerTypeCollection.cs
- ErrorHandlerModule.cs
- XmlSerializableServices.cs
- ServiceBuildProvider.cs
- StateDesigner.cs
- ColumnResizeUndoUnit.cs
- CompareValidator.cs
- DPAPIProtectedConfigurationProvider.cs
- Int16KeyFrameCollection.cs
- DefaultEvaluationContext.cs
- Pair.cs
- TextParagraphProperties.cs
- KeyNotFoundException.cs
- Byte.cs
- WebBrowserEvent.cs
- SmtpNtlmAuthenticationModule.cs
- AggregateNode.cs
- CodeDelegateInvokeExpression.cs
- MessageBox.cs