SecurityElement 构造函数
定义
初始化 SecurityElement 类的新实例。Initializes a new instance of the SecurityElement class.
重载
| SecurityElement(String) |
使用指定的标记初始化 SecurityElement 类的新实例。Initializes a new instance of the SecurityElement class with the specified tag. |
| SecurityElement(String, String) |
用指定的标记和文本初始化 SecurityElement 类的新实例。Initializes a new instance of the SecurityElement class with the specified tag and text. |
SecurityElement(String)
使用指定的标记初始化 SecurityElement 类的新实例。Initializes a new instance of the SecurityElement class with the specified tag.
public:
SecurityElement(System::String ^ tag);
public SecurityElement (string tag);
new System.Security.SecurityElement : string -> System.Security.SecurityElement
Public Sub New (tag As String)
参数
- tag
- String
XML 元素的标记名称。The tag name of an XML element.
例外
tag 参数为 null。The tag parameter is null.
tag 参数在 XML 中无效。The tag parameter is invalid in XML.
示例
下面的代码演示 SecurityElement 如何使用构造函数创建新的 SecurityElement 对象。The following code shows the use of the SecurityElement constructor to create a new SecurityElement object. 此代码示例是为类提供的更大示例的一部分 SecurityElement 。This code example is part of a larger example provided for the SecurityElement class.
SecurityElement^ windowsRoleElement = gcnew SecurityElement( L"WindowsMembership.WindowsRole" );
SecurityElement windowsRoleElement =
new SecurityElement("WindowsMembership.WindowsRole");
Dim windowsRoleElement As New SecurityElement("WindowsMembership.WindowsRole")
注解
tag参数必须包含有效的 XML 标记名称。The tag parameter must consist of a valid XML tag name. 用于 Escape 从字符串中删除无效字符。Use Escape to remove invalid characters from the string.
适用于
SecurityElement(String, String)
用指定的标记和文本初始化 SecurityElement 类的新实例。Initializes a new instance of the SecurityElement class with the specified tag and text.
public:
SecurityElement(System::String ^ tag, System::String ^ text);
public SecurityElement (string tag, string text);
public SecurityElement (string tag, string? text);
new System.Security.SecurityElement : string * string -> System.Security.SecurityElement
Public Sub New (tag As String, text As String)
参数
- tag
- String
XML 元素的标记名称。The tag name of the XML element.
- text
- String
元素中的文本内容。The text content within the element.
例外
tag 参数为 null。The tag parameter is null.
tag 参数或 text 参数在 XML 中无效。The tag parameter or text parameter is invalid in XML.
注解
如果 text 参数为,则 null 此构造函数将生成与无参数构造函数相同的元素。If the text parameter is null this constructor produces an element identical to the parameterless constructor.