SecurityElement.IsValidAttributeValue(String) 方法

定義

判斷字串是否為有效的屬性值。

public:
 static bool IsValidAttributeValue(System::String ^ value);
public static bool IsValidAttributeValue (string value);
public static bool IsValidAttributeValue (string? value);
static member IsValidAttributeValue : string -> bool
Public Shared Function IsValidAttributeValue (value As String) As Boolean

參數

value
String

要測試有效性的屬性值。

傳回

如果 value 參數是有效的 XML 屬性值,則為 true,否則為 false

範例

下列程式碼示範如何使用 IsValidAttributeValue 方法來判斷字串是否為有效的屬性值。 此程式碼範例是提供給 類別之較大範例的 SecurityElement 一部分。

if ( SecurityElement::IsValidAttributeName( attributeName ) &&
       SecurityElement::IsValidAttributeValue( attributeValue ) )
if (SecurityElement.IsValidAttributeName(attributeName) &&
    SecurityElement.IsValidAttributeValue(attributeValue))
If SecurityElement.IsValidAttributeName(attributeName) AndAlso SecurityElement.IsValidAttributeValue(attributeValue) Then

備註

在將屬性新增至安全性元素之前,這個方法可用來測試屬性。

適用於