|
If you plan on storing any kind of persistent information regarding configuration for your current user in a file the best place to store it is in the users Application Data directory. This allow data to be written regardless of the current set of security in place for that user.
C# provides a set a simple way to get this path using the Environment.GetFolderPath function.
path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
This can be used to find out other folders on the system by substituting the DesktopDirectory in the above example with any of:
Environment.SpecialFolder.ApplicationData Environment.SpecialFolder.System Environment.SpecialFolder.CommonApplicationData Environment.SpecialFolder.CommonProgramFiles Environment.SpecialFolder.Cookies Environment.SpecialFolder.Desktop Environment.SpecialFolder.DesktopDirectory Environment.SpecialFolder.Favorites Environment.SpecialFolder.History Environment.SpecialFolder.InternetCache Environment.SpecialFolder.LocalApplicationData Environment.SpecialFolder.MyComputer Environment.SpecialFolder.MyMusic Environment.SpecialFolder.MyPictures Environment.SpecialFolder.Personal Environment.SpecialFolder.ProgramFiles Environment.SpecialFolder.Programs Environment.SpecialFolder.Recent Environment.SpecialFolder.SendTo Environment.SpecialFolder.StartMenu
|
20 November 2009 IB
C#
|
Back To List
Did this article answer your question |
 |
Yes |
 |
No |
|
Other items of interest in our knowledgebase
|