ConfigurationElement.SetAttributeValue(String, Object) ConfigurationElement.SetAttributeValue(String, Object) ConfigurationElement.SetAttributeValue(String, Object) ConfigurationElement.SetAttributeValue(String, Object) Method

Definition

Sets the value of the specified attribute.

public:
 void SetAttributeValue(System::String ^ attributeName, System::Object ^ value);
public void SetAttributeValue (string attributeName, object value);
member this.SetAttributeValue : string * obj -> unit
Public Sub SetAttributeValue (attributeName As String, value As Object)

Parameters

attributeName
String String String String

The name of the attribute to change.

value
Object Object Object Object

The new value of the attribute.

Exceptions

Examples

The following example modifies the element with the name "TestDemo". The value is modified to "TestDemo(modified)".

// Use any of the following lines to set the attribute value.
// attribute.Value = "TestDemo(Modified)";
moduleproviderelement.SetAttributeValue(
    "name", "TestDemo(Modified)");
// moduleproviderelement["name"] = "TestDemo(Modified)";

Remarks

This method sets the attribute value and writes it to the Administration.config file. The Administration.config file is not modified until the CommitChanges method is called.

You can also set the attribute value by using the Item[String] or Value properties. For best system performance, you should use the SetAttributeValue method.

Applies to

See also