Csharp/C Sharp by API/System.Security.Principal/WindowsBuiltInRole — различия между версиями

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

Версия 18:31, 26 мая 2010

WindowsBuiltInRole.PowerUser

<source lang="csharp"> using System; using System.Security.Principal; class MainClass {

 public static void Main() 
 {
   WindowsIdentity wi = WindowsIdentity.GetCurrent();
   WindowsPrincipal prin = new WindowsPrincipal(wi);
   if (prin.IsInRole(WindowsBuiltInRole.PowerUser)) 
   {
     Console.WriteLine("You are a member of the Power User group");
   }
   else
   {
     Console.WriteLine("You are not a member of the Power User group");
   }
 }

}

</source>