GacIdentityPermissionAttribute Constructor (SecurityAction)
Initializes a new instance of the GacIdentityPermissionAttribute class with the specified SecurityAction value.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- action
-
Type:
System.Security.Permissions::SecurityAction
One of the SecurityAction values.
| Exception | Condition |
|---|---|
| ArgumentException | The action parameter is not a valid SecurityAction value. |
The constructor calls the base class to validate the SecurityAction value.
This constructor associates a SecurityAction (for example, Demand) with the GacIdentityPermission.
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. Use GacIdentityPermission for imperative security.
The following code example demonstrates the use of the GacIdentityPermissionAttribute constructor to demand that the calling program be in the global assembly cache. This example is part of a larger example provided for the GacIdentityPermissionAttribute class.
Available since 2.0