Share via


SecurityElement.Attribute(String) Metoda

Definice

Najde atribut podle názvu v elementu XML.

public:
 System::String ^ Attribute(System::String ^ name);
public string? Attribute (string name);
public string Attribute (string name);
member this.Attribute : string -> string
Public Function Attribute (name As String) As String

Parametry

name
String

Název atributu, který chcete vyhledat.

Návraty

Hodnota přidružená k pojmenovaným atributu, nebo null pokud neexistuje žádný atribut s name .

Výjimky

Parametr name je null.

Příklady

Následující kód ukazuje použití Attribute metody k vyhledání atributu podle názvu. Tento příklad kódu je součástí většího příkladu SecurityElement pro třídu .

String^ xmlCreationDate = xmlElement->Attribute(L"creationdate");
string xmlCreationDate = xmlElement.Attribute("creationdate");
Dim xmlCreationDate As String = xmlElement.Attribute("creationdate")

Poznámky

S následujícím kódem Attribute("B") XML by se vrátilo "456".

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

Platí pro