How do I get the current username in .NET using C#?

后端 未结 18 1716
忘了有多久
忘了有多久 2020-11-22 09:59

How do I get the current username in .NET using C#?

18条回答
  •  执念已碎
    2020-11-22 10:30

    You may also want to try using:

    Environment.UserName;
    

    Like this...:

    string j = "Your WindowsXP Account Name is: " + Environment.UserName;
    

    Hope this has been helpful.

提交回复
热议问题