StringValidatorAttribute Constructor
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the StringValidatorAttribute class.
public:
StringValidatorAttribute();
public StringValidatorAttribute ();
Public Sub New ()
Examples
The following example shows how to use the StringValidatorAttribute constructor.
[ConfigurationProperty("alias", DefaultValue = "anotherName.txt",
IsRequired = true, IsKey = false)]
[StringValidator()]
public string Alias
{
get
{
return (string)this["alias"];
}
set
{
this["alias"] = value;
}
}
<ConfigurationProperty("alias", _
DefaultValue:="anotherName.txt", _
IsRequired:=True, _
IsKey:=False), _
StringValidator()> _
Public Property [Alias]() As String
Get
Return CStr(Me("alias"))
End Get
Set(ByVal value As String)
Me("alias") = value
End Set
End Property
Remarks
You use this constructor in the attributed model to ensure that the value assigned to the configuration-element property is of a string type.
Applies to
See also
Vertu í samstarfi við okkur á GitHub
Heimildina fyrir þetta efni er að finna á GitHub, þar sem þú getur líka búið til og farið yfir vandamál og sameinað beiðnir. Frekari upplýsingar er að finna í framlagshandbók okkar.