GacIdentityPermission 构造函数

定义

初始化 GacIdentityPermission 类的新实例。

重载

GacIdentityPermission()

初始化 GacIdentityPermission 类的新实例。

GacIdentityPermission(PermissionState)

用完全受限制的 GacIdentityPermission 初始化 PermissionState 类的新实例。

GacIdentityPermission()

初始化 GacIdentityPermission 类的新实例。

public:
 GacIdentityPermission();
public GacIdentityPermission ();
Public Sub New ()

示例

下面的代码示例演示构造 GacIdentityPermission() 函数的使用。

GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission;
GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission( PermissionState::None );
if ( Gac1->Equals( Gac2 ) )
         Console::WriteLine( "GacIdentityPermission() equals GacIdentityPermission(PermissionState.None)." );
GacIdentityPermission Gac1 = new GacIdentityPermission();
GacIdentityPermission Gac2 = new GacIdentityPermission(PermissionState.None);
if (Gac1.Equals(Gac2))
    Console.WriteLine("GacIdentityPermission() equals GacIdentityPermission(PermissionState.None).");
Dim Gac1 As New GacIdentityPermission
Dim Gac2 As New GacIdentityPermission(PermissionState.None)
If (Gac1.Equals(Gac2)) Then
    Console.WriteLine("GacIdentityPermission() equals GacIdentityPermission(PermissionState.None).")
End If

注解

此构造函数创建 GacIdentityPermission 值为 PermissionState . None.

适用于

GacIdentityPermission(PermissionState)

用完全受限制的 GacIdentityPermission 初始化 PermissionState 类的新实例。

public:
 GacIdentityPermission(System::Security::Permissions::PermissionState state);
public GacIdentityPermission (System.Security.Permissions.PermissionState state);
new System.Security.Permissions.GacIdentityPermission : System.Security.Permissions.PermissionState -> System.Security.Permissions.GacIdentityPermission
Public Sub New (state As PermissionState)

参数

state
PermissionState

PermissionState 值之一。

例外

state 不是有效的 PermissionState 值。

示例

下面的代码示例演示构造 GacIdentityPermission.GacIdentityPermission(PermissionState) 函数的使用。

GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission( PermissionState::None );
GacIdentityPermission Gac1 = new GacIdentityPermission(PermissionState.None);
Dim Gac1 As New GacIdentityPermission(PermissionState.None)

注解

备注

在.NET Framework版本 1.0 和 1.1 中,标识权限不能具有Unrestricted权限状态值。 从 .NET Framework 版本 2.0 开始,标识权限可以具有任何权限状态值。 这意味着在 2.0 及更高版本中,标识权限的行为与实现 IUnrestrictedPermission 接口的权限相同。

适用于