編輯

共用方式為


ReflectionPermission Constructors

Definition

Initializes a new instance of the ReflectionPermission class.

Overloads

ReflectionPermission(PermissionState)

Initializes a new instance of the ReflectionPermission class with either fully restricted or unrestricted permission as specified.

ReflectionPermission(ReflectionPermissionFlag)

Initializes a new instance of the ReflectionPermission class with the specified access.

ReflectionPermission(PermissionState)

Source:
ReflectionPermission.cs
Source:
ReflectionPermission.cs
Source:
ReflectionPermission.cs
Source:
ReflectionPermission.cs

Initializes a new instance of the ReflectionPermission class with either fully restricted or unrestricted permission as specified.

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

Parameters

state
PermissionState

One of the PermissionState values.

Exceptions

The state parameter is not a valid value of PermissionState.

Examples

The following code example shows the use of the ReflectionPermission.ReflectionPermission(PermissionState) constructor. This example is part of a larger example provided for the ReflectionPermission class.

ReflectionPermission restrictedMemberAccessPerm = new ReflectionPermission(PermissionState.None);
Dim restrictedMemberAccessPerm As New ReflectionPermission(PermissionState.None)

Remarks

Creates either fully restricted (None) or Unrestricted access to metadata.

Applies to

ReflectionPermission(ReflectionPermissionFlag)

Source:
ReflectionPermission.cs
Source:
ReflectionPermission.cs
Source:
ReflectionPermission.cs
Source:
ReflectionPermission.cs

Initializes a new instance of the ReflectionPermission class with the specified access.

public:
 ReflectionPermission(System::Security::Permissions::ReflectionPermissionFlag flag);
public ReflectionPermission (System.Security.Permissions.ReflectionPermissionFlag flag);
new System.Security.Permissions.ReflectionPermission : System.Security.Permissions.ReflectionPermissionFlag -> System.Security.Permissions.ReflectionPermission
Public Sub New (flag As ReflectionPermissionFlag)

Parameters

Exceptions

The flag parameter is not a valid value of ReflectionPermissionFlag.

Examples

The following code example shows the use of the ReflectionPermission.ReflectionPermission(ReflectionPermissionFlag) constructor. This example is part of a larger example provided for the ReflectionPermission class.

ReflectionPermission restrictedMemberAccessPerm = new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess);
Dim restrictedMemberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess)

Applies to