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)

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)]

The scope of the declaration that is allowed depends on the that is used.

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 only for declarative security. For imperative security, use the corresponding permission class.

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

Allows security actions for to be applied to code using declarative security. This class cannot be inherited.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  To be added.
  is not a valid value.

  Initializes a new instance of the class with the specified .

  One of the values.
  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added.

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

  Sets full access for the environment variables specified by the string value.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Security.IPermission

  This method should only be called by the security system, never by application code.

  At compile time, attributes convert security declarations to a serialized form in metadata. Declarative security data in metadata is created from the permission that this method returns that corresponds to this attribute.

  Creates and returns a new .

  An that corresponds to this attribute.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

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

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

  Gets or sets read access for the environment variables specified by the string value.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String

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

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

  Gets or sets write access for the environment variables specified by the string value.

  0
0