DataProtectionPermission 构造函数

定义

初始化 DataProtectionPermission 类的新实例。Initializes a new instance of the DataProtectionPermission class.

重载

DataProtectionPermission(PermissionState)

使用指定的权限状态初始化 DataProtectionPermission 类的新实例。Initializes a new instance of the DataProtectionPermission class with the specified permission state.

DataProtectionPermission(DataProtectionPermissionFlags)

初始化具有指定权限标志的 DataProtectionPermission 类的新实例。Initializes a new instance of the DataProtectionPermission class with the specified permission flags.

DataProtectionPermission(PermissionState)

使用指定的权限状态初始化 DataProtectionPermission 类的新实例。Initializes a new instance of the DataProtectionPermission class with the specified permission state.

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

参数

state
PermissionState

PermissionState 值之一。One of the PermissionState values.

异常

state 不是有效的 PermissionState 值。state is not a valid PermissionState value.

示例

下面的代码示例演示如何使用 DataProtectionPermission(PermissionState) 构造函数。The following code example shows the use of the DataProtectionPermission(PermissionState) constructor. 此代码示例是为 DataProtectionPermission 类提供的更大示例的一部分。This code example is part of a larger example provided for the DataProtectionPermission class.

DataProtectionPermission ^ sp3 = gcnew DataProtectionPermission( PermissionState::Unrestricted );

DataProtectionPermission sp3 = new DataProtectionPermission(
    PermissionState.Unrestricted);
Dim sp3 As New DataProtectionPermission(PermissionState.Unrestricted)

注解

创建 None (完全受限制)或 Unrestricted 对数据和内存的访问。Creates either None (fully restricted) or Unrestricted access to data and memory.

另请参阅

DataProtectionPermission(DataProtectionPermissionFlags)

初始化具有指定权限标志的 DataProtectionPermission 类的新实例。Initializes a new instance of the DataProtectionPermission class with the specified permission flags.

public:
 DataProtectionPermission(System::Security::Permissions::DataProtectionPermissionFlags flag);
public:
 DataProtectionPermission(System::Security::Permissions::DataProtectionPermissionFlags flags);
public DataProtectionPermission (System.Security.Permissions.DataProtectionPermissionFlags flag);
public DataProtectionPermission (System.Security.Permissions.DataProtectionPermissionFlags flags);
new System.Security.Permissions.DataProtectionPermission : System.Security.Permissions.DataProtectionPermissionFlags -> System.Security.Permissions.DataProtectionPermission
new System.Security.Permissions.DataProtectionPermission : System.Security.Permissions.DataProtectionPermissionFlags -> System.Security.Permissions.DataProtectionPermission
Public Sub New (flag As DataProtectionPermissionFlags)
Public Sub New (flags As DataProtectionPermissionFlags)

参数

flagflags
DataProtectionPermissionFlags

DataProtectionPermissionFlags 值的按位组合。A bitwise combination of the DataProtectionPermissionFlags values.

异常

flag 不是有效的 DataProtectionPermissionFlags 值组合。flag is not a valid combination of the DataProtectionPermissionFlags values.

示例

下面的代码示例演示如何使用 DataProtectionPermission(DataProtectionPermissionFlags) 构造函数。The following code example shows the use of the DataProtectionPermission(DataProtectionPermissionFlags) constructor. 此代码示例是为 DataProtectionPermission 类提供的更大示例的一部分。This code example is part of a larger example provided for the DataProtectionPermission class.

Console::WriteLine( "Creating a permission with the Flags property ="
" ProtectData." );
DataProtectionPermission ^ sp = gcnew DataProtectionPermission( DataProtectionPermissionFlags::ProtectData );

ProtectData();
Console.WriteLine("Creating a permission with the Flags property =" +
    " ProtectData.");
DataProtectionPermission sp = new DataProtectionPermission(
    DataProtectionPermissionFlags.ProtectData);
sp.PermitOnly();
Console.WriteLine("Creating a permission with the Flags property =" + " ProtectData.")
Dim sp As New DataProtectionPermission(DataProtectionPermissionFlags.ProtectData)
sp.PermitOnly()

另请参阅

适用于