PublisherIdentityPermission Constructor (PermissionState)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

public PublisherIdentityPermission(
	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. Starting with the .NET Framework version 2.0, identity permissions can have any permission state value. This means that in 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. Starting with the .NET Framework version 2.0, 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.

The following example shows how to use the PublisherIdentityPermission.PublisherIdentityPermission(PermissionState) constructor.

// Create an empty PublisherIdentityPermission to serve as the target of the copy.
publisherPerm2 = new PublisherIdentityPermission(PermissionState.None);
publisherPerm2 = (PublisherIdentityPermission)publisherPerm1.Copy();
Console.WriteLine("Result of copy = " + publisherPerm2.ToString());

.NET Framework
Available since 1.1
Return to top
Show: