SecurityElement.AddAttribute(String, String) Method
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)
- name
- String
The name of the attribute.
- value
- String
The value of the attribute.
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.
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")
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.
Tuote | Versiot |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Tuotteen .NET palaute
.NET on avoin lähdekoodi projekti. Anna palautetta valitsemalla linkki: