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
- ThreadAbortException.cs
- StylusPlugin.cs
- CompatibleIComparer.cs
- XPathNodeIterator.cs
- ManualResetEvent.cs
- TabPanel.cs
- ImmComposition.cs
- CodeTypeReference.cs
- RectAnimation.cs
- GenerateHelper.cs
- Crypto.cs
- SoapHeaderAttribute.cs
- QilVisitor.cs
- GridViewSortEventArgs.cs
- XmlCharCheckingReader.cs
- StringUtil.cs
- SchemaImporter.cs
- CaseKeyBox.xaml.cs
- XsltException.cs
- EditorPartChrome.cs
- DiscoveryClientBindingElement.cs
- ServiceOperationViewControl.cs
- PathSegmentCollection.cs
- StickyNoteAnnotations.cs
- WinCategoryAttribute.cs
- DataGridViewCellValidatingEventArgs.cs
- BoundField.cs
- XmlSchemaSimpleTypeRestriction.cs
- LineVisual.cs
- StoragePropertyMapping.cs
- GetPageCompletedEventArgs.cs
- CellQuery.cs
- Empty.cs
- UriWriter.cs
- StdRegProviderWrapper.cs
- EmptyControlCollection.cs
- WorkflowRuntimeServiceElement.cs
- keycontainerpermission.cs
- SymbolEqualComparer.cs
- AttributeInfo.cs
- DefaultAssemblyResolver.cs
- DynamicValueConverter.cs
- HandledMouseEvent.cs
- MatrixAnimationUsingPath.cs
- Attributes.cs
- ConfigurationException.cs
- EntityCommandExecutionException.cs
- DataObjectPastingEventArgs.cs
- ConsumerConnectionPoint.cs
- ListBox.cs
- Exceptions.cs
- XmlUrlResolver.cs
- TokenBasedSetEnumerator.cs
- MouseCaptureWithinProperty.cs
- HotSpotCollection.cs
- BackgroundFormatInfo.cs
- Set.cs
- SymbolMethod.cs
- HotCommands.cs
- ContactManager.cs
- ValidationService.cs
- Reference.cs
- DPAPIProtectedConfigurationProvider.cs
- ThicknessKeyFrameCollection.cs
- Add.cs
- DocumentViewerHelper.cs
- Light.cs
- ObjectHelper.cs
- Stack.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- EditableTreeList.cs
- HttpHandler.cs
- ArglessEventHandlerProxy.cs
- invalidudtexception.cs
- PropertyToken.cs
- TreeViewAutomationPeer.cs
- SqlWorkflowPersistenceService.cs
- SubordinateTransaction.cs
- PathParser.cs
- TreeBuilder.cs
- UnauthorizedAccessException.cs
- DecimalConverter.cs
- RenameRuleObjectDialog.cs
- rsa.cs
- MetafileHeader.cs
- DynamicPropertyReader.cs
- StatusBarDrawItemEvent.cs
- BinaryObjectWriter.cs
- DoubleAnimationUsingPath.cs
- ResourceKey.cs
- WebPartEditorApplyVerb.cs
- DataControlButton.cs
- RequestCache.cs
- CompositeActivityMarkupSerializer.cs
- ModulesEntry.cs
- SafeNativeMemoryHandle.cs
- FtpWebRequest.cs
- ConfigXmlSignificantWhitespace.cs
- ConfigXmlAttribute.cs
- versioninfo.cs