Google
 
Web itpro-blogger.blogspot.com
日曜日, 9月 06, 2015

[C#]DLLからApp.configのAppSettingsの内容が読み込めない

▼質問
DLLでApp.configを作成してAppSettingsにAddを追加したけど

その内容が読み込めないだけど・・・何でだ!

▼回答
次のようにすれば読むことができるよ!!

System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(this.GetType().Module.Name);
string value = System.Configuration.ConfigurationManager.AppSettings["key"];

■関連サイト
C# access app.config file in dll


This page is powered by Blogger. Isn't yours?