Читати англійською Редагувати

Поділитися через


FileCodeGroup(IMembershipCondition, FileIOPermissionAccess) Constructor

Definition

Initializes a new instance of the FileCodeGroup class.

C#
public FileCodeGroup(System.Security.Policy.IMembershipCondition membershipCondition, System.Security.Permissions.FileIOPermissionAccess access);

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.

C#
FileCodeGroup fileCodeGroup = 
    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

Продукт Версії
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10