Share via


SecurityElement.Attribute(String) メソッド

定義

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

パラメーター

name
String

検索する属性の名前。

戻り値

名前付き属性と関連付けられた値。または name の属性が存在しない場合は null

例外

name パラメーターが null です。

次のコードは、 メソッドを使用して Attribute 属性を名前で検索する方法を示しています。 このコード例は、SecurityElement クラスのために提供されている大規模な例の一部です。

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

注釈

次のように XML を指定すると、 Attribute("B") "456" が返されます。

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

適用対象