For dot net programs, where is the "right" place to store serialized data?
In the /user/username folder? Program Files/MyAppName/? Someplace else?
For dot net programs, where is the "right" place to store serialized data?
In the /user/username folder? Program Files/MyAppName/? Someplace else?
I'd say it depends on what type of date you're looking to store. If it's user specific date then I would suggest using the path returned by
Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
If it's not user specific data, that is, it's data shared by all users of your program then storing it within a folder under your installation path is probably more appropriate.
This blog post from Microsoft's Pat Altimore suggests a number of locations, depending on what type of data you are trying to store.
.NET provides special Enum values which you can pass into System.Environment.GetFolderPath
, to get the desired 'special' folder.
In short:
SpecialFolder.ApplicationData
. SpecialFolder.CommonApplicationData
.For the machine-specific data, you will probably also need to run the program as administrator, otherwise you won't have write-access to that location.