C# difference between Environment.SpecialFolders and Application folders

拥有回忆 提交于 2020-01-01 19:08:40

问题


What is the difference between the magic paths in these namespaces:

Environment.SpecialFolder.LocalApplicationData

versus

Application.LocalUserAppDataPath

And

Environment.SpecialFolder.ApplicationData

versus

Application.CommonAppDataPath

etc...


回答1:


They are not the same. The Application version of them is aware of ClickOnce deployment, adjusting the paths accordingly to keep them isolated.




回答2:


On Windows 7:

Environment.SpecialFolder.LocalApplicationData = C:\Users\username\AppData\Local
Application.LocalUserAppDataPath = C:\Users\username\AppData\Local
Environment.SpecialFolder.ApplicationData = C:\Users\username\AppData\Roaming
Application.CommonAppDataPath = C:\Users\username\AppData\Roaming

Local is only ever stored on the local machine. Roaming is copied to the domain server (when in a domain) and is then loaded back onto other machines in that domain when you log on.



来源:https://stackoverflow.com/questions/8369627/c-sharp-difference-between-environment-specialfolders-and-application-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!