System.Security.SecurityElement Class

public sealed class SecurityElement

Base Types







Represents the XML object model for encoding security objects.


The simple XML object model for an element consists of the following parts:

An attribute name must be at least one character, and cannot be null . If element-based value representation is used, elements with a text string that is null are represented in the <tag/> form; otherwise, text is delimited by the <tag> and </tag> tokens. Both forms can be combined with attributes, which are shown if present.

The tags, attributes, and text are case-sensitive. The XML form contains quotation marks and escape sequences where necessary. String values that include characters invalid for use in XML result in a ArgumentException. These rules apply to all properties and methods.

[Note: This class is intended to be a lightweight implementation of a simple XML object model for use within the security system, and not for use as a general XML object model.

It is strongly suggested that properties of a security element are expressed as attributes, and property values are expressed as attribute values. Specifically, avoid nesting text within tags. For any &lt;tag>text</tag> representation a representation of type &lt;tag value="text"/> is usually available. Using attribute-based XML representations aids in readability.

For performance reasons, character validity is checked only when the element is encoded into XML form, and not on every set of a property or method call. Static methods allow explicit checking where needed.


See Also

System.Security Namespace


SecurityElement Methods

SecurityElement.ToString Method

SecurityElement.ToString Method

public override string ToString();


Returns a String representation of the current instance.

Return Value

A String representation of the current instance.


[Note: The XML in the String returned by this method represents the state of a permission object. To obtain the XML schema used to encode that object, see the class page for the particular permission object .

This method overrides System.Object.ToString.


See Also

System.Security.SecurityElement Class, System.Security Namespace