編輯

共用方式為


DataProtectionPermission Constructors

Definition

Initializes a new instance of the DataProtectionPermission class.

Overloads

DataProtectionPermission(DataProtectionPermissionFlags)

Initializes a new instance of the DataProtectionPermission class with the specified permission flags.

DataProtectionPermission(PermissionState)

Initializes a new instance of the DataProtectionPermission class with the specified permission state.

DataProtectionPermission(DataProtectionPermissionFlags)

Source:
DataProtectionPermission.cs
Source:
DataProtectionPermission.cs
Source:
DataProtectionPermission.cs
Source:
DataProtectionPermission.cs

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 flag);
new System.Security.Permissions.DataProtectionPermission : System.Security.Permissions.DataProtectionPermissionFlags -> System.Security.Permissions.DataProtectionPermission
Public Sub New (flag As DataProtectionPermissionFlags)

Parameters

flag
DataProtectionPermissionFlags

A bitwise combination of the DataProtectionPermissionFlags values.

Exceptions

flag is not a valid combination of the DataProtectionPermissionFlags values.

Examples

The following code example shows the use of the DataProtectionPermission(DataProtectionPermissionFlags) constructor. 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()

See also

Applies to

DataProtectionPermission(PermissionState)

Source:
DataProtectionPermission.cs
Source:
DataProtectionPermission.cs
Source:
DataProtectionPermission.cs
Source:
DataProtectionPermission.cs

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)

Parameters

state
PermissionState

One of the PermissionState values.

Exceptions

state is not a valid PermissionState value.

Examples

The following code example shows the use of the DataProtectionPermission(PermissionState) constructor. 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)

Remarks

Creates either None (fully restricted) or Unrestricted access to data and memory.

See also

Applies to