1
구성 섹션 디자이너 (csd)를 사용하여 응용 프로그램에 XML 구성 파일을 생성했습니다.csd를 사용하여 생성 된 xml에 읽기/쓰기
1이
txtbox_username.Text = ConfigurationManager.AppSettings["userName"];
같은 특정 값 (해당 분야에 의해 검색), 뭔가를 읽어
는 지금, 나는 (C#을에)이 XML 파일로 작업하고 2 일을 할 2.
는 특정 값,
config.AppSettings.Settings["userName"].Value = txtbox_username.Text;
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("configuration");
-
같은 것을 쓰기 ...
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
add key="userName" value="Value1"
</appSettings>
</configuration>
하지만 CSD는 XML은 서로 다른 모양 생성 :3210
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="sectionName" type="Sample.ConfigurationSection.sectionName, Sample.ConfigurationSection, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</configSections>
<sectionName xmlns="Sample.ConfigurationSection">
<logFile debugLevel="3" filePath="c:\new" maxFileCount="10" maxFileLength="1000"/>
<results path="C:\Results"/>
<details user="blabla" pass="12345" code="abc"/>
<stuff fromAddress="[email protected]" toAddress="[email protected]" sendMail="true""/>
</sectionName>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
여기에서 예를 들어 사용자/전달/코드 입력란을 편집하고 저장하고 싶습니다.