Last active
March 5, 2025 10:04
-
-
Save zhangr4/b0c8ebdbf9c5757e04699a9922229109 to your computer and use it in GitHub Desktop.
csharp snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Console.WriteLine(); | |
// <-- Keep this information secure! --> | |
Console.WriteLine("UserName: {0}", Environment.UserName); | |
//this one can get domain and user name | |
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name; | |
Console.WriteLine(); | |
Console.WriteLine(userName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment