Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
477 views
in Technique[技术] by (71.8m points)

c# - Difference between 'SpecialFolder.LocalApplicationData' and 'SpecialFolder.ApplicationData'?

On my system, %AppData% leads to ApplicationData which is C:Users<USER>AppDataRoaming

But there is also C:Users<USER>AppDataLocal
And for some more confusion D:Users<USER>AppDataLocalLow

string local = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string roaming = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

My question is, to which of these locations should my application save its data?

Are there guidelines for which of these locations to use? And am I leaving myself open to problems if I choose the wrong location?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Roaming folder is copied between machines when roaming profiles are enabled (in a domain environment). Use it for application data that you want to share between machines. But don't store large files in there -- IT departments don't like it when you do that, and it increases the time taken for the user to log in and to log out as the files are copied around.

The Local folder is not copied between machines. Use it for application data that's specific to a machine.

The LocalLow folder is used for low-privilege tasks (such as Internet Explorer). You shouldn't need to worry about it.

For files that the user specifically saved, you should put them (by default) in the Documents folder.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...