我想创建一个文本 block ,上面写着“欢迎用户名”。
用户名 = 当前 Windows 用户。
我在 WPF 项目中工作。
最佳答案
您应该使用 Environment.UserName
( msdn ):
Gets the user name of the person who is currently logged on to the Windows operating system.
示例:
Console.WriteLine("UserName: {0}", Environment.UserName);
关于c# - 如何显示当前用户名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17906576/