แก้ไข

แชร์ผ่าน


SecurityElement.IsValidAttributeName(String) Method

Definition

Determines whether a string is a valid attribute name.

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

Parameters

name
String

The attribute name to test for validity.

Returns

true if the name parameter is a valid XML attribute name; otherwise, false.

Examples

The following code shows the use of the IsValidAttributeName method to determine whether a string is a valid attribute name. This code example is part of a larger example provided for the SecurityElement class.

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

Remarks

This method can be used to test an attribute before adding it to a security element.

Applies to