SecurityElement::Attribute Method (String^)

 

Finds an attribute by name in an XML element.

Namespace:   System.Security
Assembly:  mscorlib (in mscorlib.dll)

public:
String^ Attribute(
	String^ name
)

Parameters

name
Type: System::String^

The name of the attribute for which to search.

Return Value

Type: System::String^

The value associated with the named attribute, or null if no attribute with name exists.

Exception Condition
ArgumentNullException

The name parameter is null.

With XML as follows, Attribute("B") would return "456".

<thetag A="123" B="456" C="789">text</thetag>

The following code shows the use of the Attribute method to find an attribute by name. This code example is part of a larger example provided for the SecurityElement class.

String^ xmlCreationDate = xmlElement->Attribute(L"creationdate");

.NET Framework
Available since 1.1
Return to top
Show: