Condividi tramite


ConfigurationElement.GetAttributeValue(String) Metodo

Definizione

Restituisce il valore dell'attributo specificato.

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

Parametri

attributeName
String

Nome dell'attributo richiesto.

Restituisce

Oggetto che rappresenta l'attributo richiesto, se esistente; in caso contrario, null.

Eccezioni

Il parametro attributeName è null o vuoto.

Esempio

L'esempio seguente ottiene il valore dell'attributo.

// 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"];

Commenti

Se il nome dell'attributo richiesto non è nel valore della RawAttributes proprietà , questo metodo restituisce null.

È anche possibile ottenere il valore dell'attributo usando la Item[] proprietà o la Microsoft.Web.Administration.ConfigurationAttribute.Value proprietà . GetAttributeValue è il metodo preferito.

Si applica a

Vedi anche