mark PrincipalPermissionAttribute : PrincipalPermissionAttribute « System.Security.Permissions « C# / C Sharp by API






mark PrincipalPermissionAttribute

 


using System;
using System.IO;
using System.Security.Permissions;

[PrincipalPermissionAttribute(SecurityAction.Demand, Role="Administrators")]
class MainClass
{
  public static void Main() 
  {
    FileStream fsOut = File.Create(@"c:\\temp\\test.txt");
    StreamWriter sw = new StreamWriter(fsOut);
    sw.WriteLine("str");
    sw.Flush();
    sw.Close();
  }
}

   
  








Related examples in the same category