EnvironmentPermissionECMA 1.0, serializable

System.Security.Permissions (mscorlib.dll)sealed class
public sealed class EnvironmentPermission : System.Security.CodeAccessPermission : IUnrestrictedPermission, 
   IBuiltInPermission {
// Public Constructors
   public EnvironmentPermission(EnvironmentPermissionAccess flag, string pathList);
   public EnvironmentPermission(PermissionState state);
// Public Instance Methods
   public void AddPathList(EnvironmentPermissionAccess flag, string pathList);
   public override IPermission Copy(  );        
// overrides CodeAccessPermission
   public override void FromXml(System.Security.SecurityElement esd);
 // overrides CodeAccessPermission
   public string GetPathList(EnvironmentPermissionAccess flag);
   public override IPermission Intersect(System.Security.IPermission target); 
 // overrides CodeAccessPermission
   public override bool IsSubsetOf(System.Security.IPermission target);
 // overrides CodeAccessPermission
   public bool IsUnrestricted(  );   
// implements IUnrestrictedPermission
   public void SetPathList(EnvironmentPermissionAccess flag, string pathList);
   public override SecurityElement ToXml(  );   
// overrides CodeAccessPermission
   public override IPermission Union(System.Security.IPermission other);
 // overrides CodeAccessPermission

This code-access permission controls access to read and write environment variables, as well as the ability to call certain members of the System.Environment class. To create an EnvironmentPermission object representing access to a specific set of environment variables, pass a semicolon-separated list of environment variable names to the object constructor along with a value from the EnvironmentPermissionAccess enumeration. The EnvironmentPermissionAccess enumeration contains values that represent the type of access granted to an environment variable, such as permission to read or write.

The EnvironmentPermission class maintains separate lists of environment variables with read access (EnvironmentPermissionAccess.Read), and those with write access (EnvironmentPermissionAccess.Write). The EnvironmentPermission class does not treat the EnvironmentPermissionAccess.AllAccess as a separate value, and instead assigns independent read and write access to environment variables assigned this access level.

The lists of accessible environment variables are managed using the SetPathList( ) and AddPathList( ) methods, which both take values of the EnvironmentPermissionAccess enumeration and a semicolon-separated list of environment variable names as arguments. SetPathList( ) replaces the existing list of variables with the new set; its EnvironmentPermissionAccess argument specifies whether to replace the read or write list. AddPathList( ) grants access to the specified variables, adding them to the existing list; its EnvironmentPermissionAccess argument specifies which variable list to modify.

The GetPathList( ) method returns a semi-colon separated list of environment variables that has access to the specified type. GetPathList( ) accepts only the EnvironmentPermissionAccess.Read or EnvironmentPermissionAccess.Write values, and will throw a System.ArgumentException if any other values is specified.


System.Object System.Security.CodeAccessPermission(System.Security.IPermission, System.Security.ISecurityEncodable, System.Security.IStackWalk) EnvironmentPermission(IUnrestrictedPermission, IBuiltInPermission)

    Part V: API Quick Reference