StrongNameIdentityPermission Constructor (PermissionState)

 

Initializes a new instance of the StrongNameIdentityPermission class with the specified PermissionState.

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

public:
StrongNameIdentityPermission(
	PermissionState state
)

Parameters

state
Type: System.Security.Permissions::PermissionState

One of the PermissionState values.

Exception Condition
ArgumentException

The state parameter is not a valid value of PermissionState.

Creates either a fully restricted (None) or Unrestricted permission.

System_CAPS_noteNote

In the .NET Framework versions 1.0 and 1.1, identity permissions cannot have an Unrestricted permission state value. In the .NET Framework version 2.0 and later, identity permissions can have any permission state value. This means that in version 2.0 and later versions, identity permissions have the same behavior as permissions that implement the IUnrestrictedPermission interface. That is, a demand for an identity always succeeds, regardless of the identity of the assembly, if the assembly has been granted full trust.

In the .NET Framework versions 1.0 and 1.1, demands on the identity permissions are effective, even when the calling assembly is fully trusted. That is, although the calling assembly has full trust, a demand for an identity permission fails if the assembly does not meet the demanded criteria. In the .NET Framework version 2.0 and later, demands for identity permissions are ineffective if the calling assembly has full trust. This assures consistency for all permissions, eliminating the treatment of identity permissions as a special case.

Use this constructor with a permission state value of None to create an identity permission that matches no strong names. If you subsequently set the Name and Version properties, a specific strong name identity can be represented by the permission.

The following code example shows the use of the StrongNameIdentityPermission constructor.

snIdPerm2 = gcnew StrongNameIdentityPermission(PermissionState::None);

.NET Framework
Available since 1.1
Return to top
Show: