如何进入桌面在​​C#中当前用户的路径? [英] How to get a path to the desktop for current user in C#?

查看:143
本文介绍了如何进入桌面在​​C#中当前用户的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何进入桌面当前用户的路径在C#?

我能找到的唯一的事情是VB.NET,只有一流的 SpecialDirectories ,它具有这个属性:

  My.Computer.FileSystem.SpecialDirectories.Desktop

我怎样才能做到这在C#?


解决方案

 路径字符串= Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

How do I get a path to the desktop for current user in C#?

The only thing I could find was the VB.NET-only class SpecialDirectories, which has this property:

My.Computer.FileSystem.SpecialDirectories.Desktop

How can I do this in C#?

解决方案

string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

这篇关于如何进入桌面在​​C#中当前用户的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆