This documentation is archived and is not being maintained.

FileIOPermission Constructor

.NET Framework 1.1

Initializes a new instance of the FileIOPermission class.

Overload List

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

[Visual Basic] Public Sub New(PermissionState)
[C#] public FileIOPermission(PermissionState);
[C++] public: FileIOPermission(PermissionState);
[JScript] public function FileIOPermission(PermissionState);

Initializes a new instance of the FileIOPermission class with the specified access to the specified file or directory.

[Visual Basic] Public Sub New(FileIOPermissionAccess, String)
[C#] public FileIOPermission(FileIOPermissionAccess, string);
[C++] public: FileIOPermission(FileIOPermissionAccess, String*);
[JScript] public function FileIOPermission(FileIOPermissionAccess, String);

Initializes a new instance of the FileIOPermission class with the specified access to the specified files and directories.

[Visual Basic] Public Sub New(FileIOPermissionAccess, String())
[C#] public FileIOPermission(FileIOPermissionAccess, string[]);
[C++] public: FileIOPermission(FileIOPermissionAccess, String[]);
[JScript] public function FileIOPermission(FileIOPermissionAccess, String[]);

Example

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of the FileIOPermission constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Console.WriteLine("Creating a FileIOPermission with AllAccess rights for 'C:\Examples\Test\TestFile.txt")
fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\Examples\Test\TestFile.txt")

[C#] 
Console.WriteLine("Creating a FileIOPermission with AllAccess rights for 'C:\\Examples\\Test\\TestFile.txt");
fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\\Examples\\Test\\TestFile.txt");

[C++] 
Console::WriteLine(S"Creating a FileIOPermission with AllAccess rights for 'C:\\Examples\\Test\\TestFile.txt");
fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess::AllAccess, S"C:\\Examples\\Test\\TestFile.txt");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

FileIOPermission Class | FileIOPermission Members | System.Security.Permissions Namespace

Show: