System Security Permissions C# by API

using System;
using System.Security.Permissions;
class MainClass
{
    public static void MyMethod() 
    { 
 
        PrincipalPermission perm = new PrincipalPermission(@"MACHINE\Joe", @"MACHINE\Managers");
            
        perm.Demand();
    }
}