private
string AppConfigRead(string keyName)
{
string strReturn;
Configuration currentConfig
=
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if
(currentConfig.AppSettings.Settings.AllKeys.Contains(keyName))
strReturn =
currentConfig.AppSettings.Settings[keyName].Value;
else
strReturn = ""; //키가없으면.
return
strReturn;
}
private bool
AppConfigWrite(string keyName, string value)
{
Configuration currentConfig
=
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if
(currentConfig.AppSettings.Settings.AllKeys.Contains(keyName)) //키가
있으면
currentConfig.AppSettings.Settings[keyName].Value =
value;
else //키가
없으면
currentConfig.AppSettings.Settings.Add(keyName,
value);
currentConfig.Save();
ConfigurationManager.RefreshSection("appSettings");
// 내용
갱신
return true;
}
'IT > TIP&TALK' 카테고리의 다른 글
모니터 제어, 미니팝업창, 트레이 아이콘 (0) | 2009.10.07 |
---|---|
닷넷에서 native dll 사용하기 (0) | 2009.09.29 |
[응용프로그램조이기] 키 상수값 (Virtual-Key Codes) (0) | 2009.09.08 |
COM+ 관리: 구성 요소 서비스 관리 도구 이해 (0) | 2009.09.08 |
[유용한팁] Visual C# 에서의 메세지 후킹 (0) | 2009.09.08 |