FileIOPermission.AddPathList Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds access for the specified files and directories to the existing state of the permission.
Overloads
AddPathList(FileIOPermissionAccess, String) |
Adds access for the specified file or directory to the existing state of the permission. |
AddPathList(FileIOPermissionAccess, String[]) |
Adds access for the specified files and directories to the existing state of the permission. |
AddPathList(FileIOPermissionAccess, String)
- Source:
- FileIOPermission.cs
- Source:
- FileIOPermission.cs
- Source:
- FileIOPermission.cs
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
- access
- FileIOPermissionAccess
A bitwise combination of the FileIOPermissionAccess values.
- path
- 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.
The path
parameter is null
.
The path
parameter has an invalid format.
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.
Applies to
AddPathList(FileIOPermissionAccess, String[])
- Source:
- FileIOPermission.cs
- Source:
- FileIOPermission.cs
- Source:
- FileIOPermission.cs
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
- access
- FileIOPermissionAccess
A bitwise combination of the FileIOPermissionAccess values.
- 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.
The pathList
parameter is null
.
Remarks
Use this method to modify file and directory access by adding to the state of the current permission.