SecurityElement.AddAttribute(String, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds a name/value attribute to an XML element.
public:
void AddAttribute(System::String ^ name, System::String ^ value);
public void AddAttribute (string name, string value);
member this.AddAttribute : string * string -> unit
Public Sub AddAttribute (name As String, value As String)
Parameters
- name
- String
The name of the attribute.
- value
- String
The value of the attribute.
Exceptions
The name
parameter or value
parameter is null
.
The name
parameter or value
parameter is invalid in XML.
-or-
An attribute with the name specified by the name
parameter already exists.
Examples
The following code shows the use of the AddAttribute method to add a name/value attribute to an XML element. This code example is part of a larger example provided for the SecurityElement class.
windowsRoleElement->AddAttribute( L"version", L"1.00" );
windowsRoleElement.AddAttribute("version","1.00");
windowsRoleElement.AddAttribute("version", "1.00")
Remarks
Names and values in attributes should only contain valid XML attribute characters. XML attribute names must be unique. Use Escape to remove invalid characters from the string.
There is no support for quoted strings, so strings for name/value pairs should not contain quotes or other characters requiring quoting.