how to get pc username 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