Csharp/C Sharp by API/System.Security.Permissions/FileIOPermissionAttribute

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

mark FileIOPermissionAttribute

  
using System;
using System.IO;
using System.Security.Permissions;
[assembly:FileIOPermissionAttribute(SecurityAction.RequestMinimum, All=@"c:\\temp")]
public class MainClass
{
    public static void Main() 
    {
        FileStream fsOut = File.Create(@"c:\test.txt");
        StreamWriter sw = new StreamWriter(fsOut);
        sw.WriteLine("asdf.");
        sw.Flush();
        sw.Close();
    }
}