次の方法で共有


ConfigurationElement.GetAttributeValue(String) メソッド

定義

指定した属性の値を返します。

public:
 System::Object ^ GetAttributeValue(System::String ^ attributeName);
public object GetAttributeValue (string attributeName);
member this.GetAttributeValue : string -> obj
Public Function GetAttributeValue (attributeName As String) As Object

パラメーター

attributeName
String

要求された属性の名前。

戻り値

要求された属性を表す オブジェクト (存在する場合)。それ以外の場合は null

例外

attributeName パラメーターは null または空です。

次の例では、 属性値を取得します。

// Use any of the following lines to retrieve the attribute value.
// attributeBag[ConfigurationDemoGlobals.AttributeName] = "name";
attributeBag[ConfigurationDemoGlobals.AttributeName] =
    moduleproviderelement.GetAttributeValue("name");
// attributeBag[ConfigurationDemoGlobals.AttributeName] =
//    moduleproviderelement["name"];

注釈

要求された属性の名前が プロパティの値 RawAttributes にない場合、このメソッドは を返します null

また、 プロパティまたは プロパティを使用して属性値をItem[]Microsoft.Web.Administration.ConfigurationAttribute.Value取得することもできます。 GetAttributeValue が推奨される方法です。

適用対象

こちらもご覧ください