BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Security.Permissions.CodeAccessSecurityAttribute System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.All, AllowMultiple=true, Inherited=false) System.Runtime.InteropServices.ComVisible(true)

Used to declaratively specify security actions to control access to environment variables.

Environment variable names are case-insensitive. Multiple environment variable names are specified by separating the names using the string.

The level of access to one or more environment variables is specified using the members of the current instance. For example, to specify read permissions for an environment variable, set the property equal to the name of the environment variable.

The security information declared by a security attribute is stored in the metadata of the attribute target, and is accessed by the system at run-time. Security attributes are used for declarative security only. For imperative security, use the corresponding permission class, .

The allowable targets are determined by the passed to the constructor.

The following example shows a declarative request for the ability to read the specified environment variables. The security action indicates that this is the minimum permission required for the target assembly to be able to execute.

[assembly:EnvironmentPermissionAttribute(SecurityAction.RequestMinimum, Read="COMPUTERNAME;USERNAME;USERDOMAIN")]

The following example shows how to demand that the calling code has unrestricted access to all environment variables. Demands are typically made in managed libraries to protect methods or classes from malicious code.

[EnvironmentPermissionAttribute(SecurityAction.Demand, Unrestricted=true)]

- Constructor
  A value.

  Constructs and initializes a new instance of the class with the specified value.

  To be added.
  is not a valid value.
  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.String To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Security.IPermission

  Returns a new that contains the security information of the current instance.

  A new object with the security information of the current instance.

  Applications typically do not call this method; it is intended for use by the system.

  The security information described by a security attribute is stored in the metadata of the attribute target, and is accessed by the system at run-time. The system uses the object returned by this method to convert the security information of the current instance into the form stored in metadata.

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.String

  Gets or sets the environment variables for which read access is secured.

  A containing one or more environment variables for which read access is secured.

  Multiple environment variable names are specified by separating the names using the string. Environment variable names are case-insensitive.

  The security action passed to the constructor of the current instance determines how the specified environment variables are secured. For example, if the action is , then the target of the current instance requires read access to the specified variables in order to execute. If the action is , then the system does not allow the target to read the specified variables.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.String

  Gets or sets the environment variables for which write access is secured.

  A containing one or more environment variables for which write access is secured.

  Multiple environment variable names are specified by separating the names using the string. Environment variable names are case-insensitive.

  The security action passed to the constructor of the current instance determines how the specified environment variables are secured. For example, if the action is , then the target of the current instance requires write access to the specified variables in order to execute. If the action is , then the system does not allow the target to write the specified variables.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
0