StringValidatorAttribute.MaxLength プロパティ
アセンブリ: System.Configuration (system.configuration.dll 内)
構文Dim instance As StringValidatorAttribute Dim value As Integer value = instance.MaxLength instance.MaxLength = value
プロパティに割り当てることができる文字列の最大長を示す整数。
使用例MaxLength プロパティを使用する方法の例を次に示します。
<ConfigurationProperty("fileName", _ DefaultValue:="default.txt", _ IsRequired:=True, _ IsKey:=False), _ StringValidator( _ InvalidCharacters:=" ~!@#$%^&*()[]{}/;'""|\", _ MinLength:=1, _ MaxLength:=60)> _ Public Property FileName() As String Get Return CStr(Me("fileName")) End Get Set(ByVal value As String) Me("fileName") = value End Set End Property
[ConfigurationProperty("fileName", DefaultValue = "default.txt"
,
IsRequired = true, IsKey = false)]
[StringValidator(InvalidCharacters = " ~!@#$%^&*()[]{}/;'\"|\\"
,
MinLength = 1, MaxLength = 60)]
public string FileName
{
get
{
return (string)this["fileName"];
}
set
{
this["fileName"] = value;
}
}
プラットフォームWindows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照- StringValidatorAttribute.MaxLength プロパティのページへのリンク