2011-09-08 40 views
4

可能重複:
What is the difference between app.config file and XYZ.settings file?Settings.settings vs app.config?

請告訴我大的區別就在這裏?我喜歡使用Settings.Settings,因爲編輯器並沒有獲取app.config中的所有xml。

+2

如果您打算使用app.config,最好習慣編輯xml文件。 –

+0

希望低於類似線程的幫助。我看到的最大區別是Settings可以用來存儲用戶特定的信息,而app.config主要用於應用程序相關的配置。 http://stackoverflow.com/questions/909688/what-is-the-difference-between-app-config-file-and-xyz-settings-file http://stackoverflow.com/questions/2539460/settings-file -vs-app-config [Settings.settings與web.config或app.config有什麼區別?](http://forums.asp.net/t/1473428.aspx) – CharithJ

回答

4

Settings.settings是Visual Studio的設計器文件,用於生成設置類,如.resx文件如何保存資源。

設置必須存儲在某個位置,但它們不存儲在Settings.settings(默認值)中。它們存儲在.config文件中。

使用生成的類,您可以更新app.config,而不用擔心操作XML。

0

您不應該在設置文件中設置環境值(如連接字符串部分),因爲它們在那裏不受保護。此外,app.config中的設置無法從設置文件中設置,因此,在一段時間內,您將不得不使用這兩個文件。

相關問題