如何在 C# 中获取当前用户的桌面路径? [英] How to get a path to the desktop for current user in C#?
本文介绍了如何在 C# 中获取当前用户的桌面路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 C# 中获取当前用户的桌面路径?
How do I get a path to the desktop for current user in C#?
我唯一能找到的是 VB.NET-only 类 SpecialDirectories
,它有这个属性:
The only thing I could find was the VB.NET-only class SpecialDirectories
, which has this property:
My.Computer.FileSystem.SpecialDirectories.Desktop
如何在 C# 中执行此操作?
How can I do this in C#?
推荐答案
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
这篇关于如何在 C# 中获取当前用户的桌面路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文