SecurityElement Constructors

Definition

Initializes a new instance of the SecurityElement class.

Overloads

SecurityElement(String)

Initializes a new instance of the SecurityElement class with the specified tag.

SecurityElement(String, String)

Initializes a new instance of the SecurityElement class with the specified tag and text.

SecurityElement(String)

Source:
SecurityElement.cs
Source:
SecurityElement.cs
Source:
SecurityElement.cs

Initializes a new instance of the SecurityElement class with the specified tag.

public SecurityElement (string tag);

Parameters

tag
String

The tag name of an XML element.

Exceptions

The tag parameter is null.

The tag parameter is invalid in XML.

Examples

The following code shows the use of the SecurityElement constructor to create a new SecurityElement object. This code example is part of a larger example provided for the SecurityElement class.

SecurityElement windowsRoleElement =
    new SecurityElement("WindowsMembership.WindowsRole");

Remarks

The tag parameter must consist of a valid XML tag name. Use Escape to remove invalid characters from the string.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.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

SecurityElement(String, String)

Source:
SecurityElement.cs
Source:
SecurityElement.cs
Source:
SecurityElement.cs

Initializes a new instance of the SecurityElement class with the specified tag and text.

public SecurityElement (string tag, string? text);
public SecurityElement (string tag, string text);

Parameters

tag
String

The tag name of the XML element.

text
String

The text content within the element.

Exceptions

The tag parameter is null.

The tag parameter or text parameter is invalid in XML.

Remarks

If the text parameter is null this constructor produces an element identical to the parameterless constructor.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.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