FileIOPermission.AddPathList FileIOPermission.AddPathList FileIOPermission.AddPathList FileIOPermission.AddPathList Method

Definition

Adds access for the specified files and directories to the existing state of the permission.

Overloads

AddPathList(FileIOPermissionAccess, String) AddPathList(FileIOPermissionAccess, String) AddPathList(FileIOPermissionAccess, String) AddPathList(FileIOPermissionAccess, String)

Adds access for the specified file or directory to the existing state of the permission.

AddPathList(FileIOPermissionAccess, String[]) AddPathList(FileIOPermissionAccess, String[]) AddPathList(FileIOPermissionAccess, String[]) AddPathList(FileIOPermissionAccess, String[])

Adds access for the specified files and directories to the existing state of the permission.

AddPathList(FileIOPermissionAccess, String) AddPathList(FileIOPermissionAccess, String) AddPathList(FileIOPermissionAccess, String) AddPathList(FileIOPermissionAccess, String)

Adds access for the specified file or directory to the existing state of the permission.

public:
 void AddPathList(System::Security::Permissions::FileIOPermissionAccess access, System::String ^ path);
public void AddPathList (System.Security.Permissions.FileIOPermissionAccess access, string path);
member this.AddPathList : System.Security.Permissions.FileIOPermissionAccess * string -> unit
Public Sub AddPathList (access As FileIOPermissionAccess, path As String)

Parameters

path
String String String String

The absolute path of a file or directory.

Exceptions

The access parameter is not a valid value of FileIOPermissionAccess.

-or-

The path parameter is not a valid string.

-or-

The path parameter did not specify the absolute path to the file or directory.

Examples

The following code example shows the use of the FileIOPermission.AddPathList(FileIOPermissionAccess, String) method.

FileIOPermission^ f2 = gcnew FileIOPermission( FileIOPermissionAccess::Read,"C:\\test_r" );
f2->AddPathList( (FileIOPermissionAccess) (FileIOPermissionAccess::Write | FileIOPermissionAccess::Read), "C:\\example\\out.txt" );
try
{
 f2->Demand();
}
catch (SecurityException^ s)
{
 Console::WriteLine(s->Message);
}
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Read, "C:\\test_r");
f2.AddPathList(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, "C:\\example\\out.txt");
try
{
    f2.Demand();
}
catch (SecurityException s)
{
    Console.WriteLine(s.Message);
}
Dim f2 As New FileIOPermission(FileIOPermissionAccess.Read, "C:\test_r")
f2.AddPathList(FileIOPermissionAccess.Write Or FileIOPermissionAccess.Read, "C:\example\out.txt")
Try
    f2.Demand()
Catch s As SecurityException
    Console.WriteLine(s.Message)
End Try

Remarks

Use this method to modify file and directory access by adding to the state of the current permission.

AddPathList(FileIOPermissionAccess, String[]) AddPathList(FileIOPermissionAccess, String[]) AddPathList(FileIOPermissionAccess, String[]) AddPathList(FileIOPermissionAccess, String[])

Adds access for the specified files and directories to the existing state of the permission.

public:
 void AddPathList(System::Security::Permissions::FileIOPermissionAccess access, cli::array <System::String ^> ^ pathList);
public void AddPathList (System.Security.Permissions.FileIOPermissionAccess access, string[] pathList);
member this.AddPathList : System.Security.Permissions.FileIOPermissionAccess * string[] -> unit
Public Sub AddPathList (access As FileIOPermissionAccess, pathList As String())

Parameters

pathList
String[]

An array containing the absolute paths of the files and directories.

Exceptions

The access parameter is not a valid value of FileIOPermissionAccess.

-or-

An entry in the pathList array is not valid.

An entry in the pathList array has an invalid format.

Remarks

Use this method to modify file and directory access by adding to the state of the current permission.

Applies to