ConfigurationElement.GetAttributeValue(String) Método

Definición

Devuelve el valor del atributo especificado.

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

Parámetros

attributeName
String

Nombre del atributo solicitado.

Devoluciones

Objeto que representa el atributo solicitado, si existe; de lo contrario, null.

Excepciones

El parámetro attributeName es null o está vacío.

Ejemplos

En el ejemplo siguiente se obtiene el valor del atributo.

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

Comentarios

Si el nombre del atributo solicitado no está en el valor de la RawAttributes propiedad , este método devuelve null.

También puede obtener el valor del atributo mediante la Item[] propiedad o la Microsoft.Web.Administration.ConfigurationAttribute.Value propiedad . GetAttributeValue es el método preferido.

Se aplica a

Consulte también