GacIdentityPermissionAttribute Constructor (SecurityAction)


Initializes a new instance of the GacIdentityPermissionAttribute class with the specified SecurityAction value.

Namespace:   System.Security.Permissions
Assembly:  mscorlib (in mscorlib.dll)

public GacIdentityPermissionAttribute(
	SecurityAction action


Type: System.Security.Permissions.SecurityAction

One of the SecurityAction values.

Exception Condition

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.

// Demand that the calling program be in the global assembly cache.
public class Class1

.NET Framework
Available since 2.0
Return to top