本文整理汇总了C#中System.Security.Permissions.FileIOPermission类的典型用法代码示例。如果您正苦于以下问题:C# FileIOPermission类的具体用法?C# FileIOPermission怎么用?C# FileIOPermission使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileIOPermission类属于System.Security.Permissions命名空间,在下文中一共展示了FileIOPermission类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileIOPermission
FileIOPermission f = new FileIOPermission(PermissionState.None);
f.AllLocalFiles = FileIOPermissionAccess.Read;
try
{
f.Demand();
}
catch (SecurityException s)
{
Console.WriteLine(s.Message);
}
示例2: FileIOPermission
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);
}
示例3: new FileIOPermission()
//引入命名空间
using System;
using System.Security;
using System.Security.Permissions;
class MainClass
{
public static void Main()
{
FileIOPermission fileIOPerm = new FileIOPermission(FileIOPermissionAccess.Write, @"C:\Data");
Console.WriteLine(SecurityManager.IsGranted(fileIOPerm));
}
}