แก้ไข

แชร์ผ่าน


FileCodeGroup(IMembershipCondition, FileIOPermissionAccess) Constructor

Definition

Initializes a new instance of the FileCodeGroup class.

public:
 FileCodeGroup(System::Security::Policy::IMembershipCondition ^ membershipCondition, System::Security::Permissions::FileIOPermissionAccess access);
public FileCodeGroup (System.Security.Policy.IMembershipCondition membershipCondition, System.Security.Permissions.FileIOPermissionAccess access);
new System.Security.Policy.FileCodeGroup : System.Security.Policy.IMembershipCondition * System.Security.Permissions.FileIOPermissionAccess -> System.Security.Policy.FileCodeGroup
Public Sub New (membershipCondition As IMembershipCondition, access As FileIOPermissionAccess)

Parameters

membershipCondition
IMembershipCondition

A membership condition that tests evidence to determine whether this code group applies policy.

access
FileIOPermissionAccess

One of the FileIOPermissionAccess values. This value is used to construct the FileIOPermission that is granted.

Exceptions

The membershipCondition parameter is null.

The type of the membershipCondition parameter is not valid.

-or-

The type of the access parameter is not valid.

Examples

The following code shows the use of the FileCodeGroup constructor. This code example is part of a larger example provided for the FileCodeGroup class.

FileCodeGroup^ fileCodeGroup = gcnew FileCodeGroup(
   gcnew AllMembershipCondition,FileIOPermissionAccess::AllAccess );
FileCodeGroup fileCodeGroup = 
    new FileCodeGroup(
    new AllMembershipCondition(),
    FileIOPermissionAccess.AllAccess);
Dim fileCodeGroup As New FileCodeGroup( _
    New AllMembershipCondition, _
    FileIOPermissionAccess.AllAccess)

Remarks

This constructor creates a basic code group. Child code groups can be added with the AddChild method.

FileCodeGroup returns a permission set containing a dynamically-calculated FileIOPermission that grants file access to the directory from which the code is run. The type of access granted is determined by the access parameter.

Applies to