views:

9347

answers:

6

This should be a no brainer, but somehow I can't persuade Google to give me a decent answer.

The only think I could find is the VB-only class SpecialDirectories, which has this property:

My.Computer.FileSystem.SpecialDirectories.Desktop

How can i do this in C# ?

+32  A: 
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
Marc Gravell
+12  A: 
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
Fraser
+3  A: 

this will return the required path.

System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

serioys sam
+3  A: 

You can do this:

string dir=Environment.GetFolderPath(SpecialFolder.DesktopDirectory);
Sean
A: 

Thank you all.It works's fine

ivreddy
Welcome to Stack Overflow! You should post an answer if it brings new information pertaining to the question. For the 'thank you', you should just put a comment.
Cristi Diaconescu
...not that I think of it, you may not be able to post comments until your reputation gets a bit higher...
Cristi Diaconescu