See Also: EnvironmentPermission Members
System.Object
System.Security.CodeAccessPermission
System.Security.Permissions.EnvironmentPermission
All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.
Note:System.Security.Permissions.EnvironmentPermission objects describe protected operations on environment variables. This permission distinguishes between the following types of access provided by System.Security.Permissions.EnvironmentPermissionAccess:
- Read: Read values from environment variables.
- Write: Write values to environment variables. Also allows for creating and deleting values.
- NoAccess: No access to environment variables.
- AllAccess: Full access to environment variables. Identical to specifying Read and Write access.
These access levels are independent, meaning that rights to one do not imply rights to another. For example, Write permission does not imply permission to Read. System.Security.Permissions.EnvironmentPermissionAccess values can be combined using a bitwise OR operator.
The Environment class is used to access environment variables, subject to the permissions defined by System.Security.Permissions.EnvironmentPermission. Environment variables are case-insensitive.
The XML encoding of a System.Security.Permissions.EnvironmentPermission instance is defined below in EBNF format. The following conventions are used:
- All non-literals in the grammar below are shown in normal type.
- All literals are in bold font.
The following meta-language symbols are used:
- '*' represents a meta-language symbol suffixing an expression that can appear zero or more times.
- '?' represents a meta-language symbol suffixing an expression that can appear zero or one time.
- '+' represents a meta-language symbol suffixing an expression that can appear one or more times.
- '(',')' is used to group literals, non-literals or a mixture of literals and non-literals.
- '|' denotes an exclusive disjunction between two expressions.
- '::=' denotes a production rule where a left hand non-literal is replaced by a right hand expression containing literals, non-literals or both.
BuildVersion refers to the build version of the shipping CLI. This is specified as a dotted build number such as '2412.0' .
ECMAPubKeyToken ::= b77a5c561934e089
EnvironmentVariable refers to the name of a single environment variable, such as 'PROMPT'.
The XML encoding of an EnvironmentPermission instance is as follows:
EnvironmentPermissionXML ::=
<IPermission
class="
System.Security.Permissions.EnvironmentPermission,
mscorlib,
Version=1.0.BuildVersion,
Culture=neutral,
PublicKeyToken=ECMAPubKeyToken"
version="1"
(
Unrestricted="true"
)
|
(
(Read=" EnvironmentVariable (; EnvironmentVariable)*" )?
(Write="EnvironmentVariable (; EnvironmentVariable)* " )?
)
/>
Namespace: System.Security.Permissions
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0