Security C# Tutorial

using System;
using System.Threading;
using System.Security;
using System.Security.Permissions;
using System.Collections.Generic;
using System.Text;
using System.Collections;
    class Program
    {
        static void Main(string[] args)
        {          
            System.Security.Principal.WindowsIdentity wi = System.Security.Principal.WindowsIdentity.GetCurrent();
            Thread.CurrentPrincipal = new System.Security.Principal.WindowsPrincipal(wi);
            Console.WriteLine(wi.Name);
            Console.WriteLine(Thread.CurrentPrincipal.Identity.Name);
            PrincipalPermission pp = new PrincipalPermission(null, "Administrators", true);
            pp.Demand();
            PrincipalPermission pp2 = new PrincipalPermission(null, "Users", true);
            pp.Union(pp2).Demand();
            try
            {
                PrincipalPermission pp3 = new PrincipalPermission(null, "Club");
                pp3.Demand();
            }
            catch (SecurityException e)
            {
                Console.WriteLine("You do not have access to the secret club.");
            }
        }
    }