username rules in c# code example
Example 1: c# get username
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Example 2: c# get username
Environment.UserName
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Environment.UserName