Helo構成要素の入手方法
構成要素を.configファイルから取得する方法を教えてもらえますか? 私は属性を処理する方法を知っていますが、要素は知りません。一例として、私は次のように解析する:
<MySection enabled="true">
<header><![CDATA[ <div> .... </div> ]]></header>
<title> .... </title>
</MySection>
私のC#のコードは、これまでに次のようになります。
public class MyConfiguration : ConfigurationSection
{
[ConfigurationProperty("enabled", DefaultValue = "true")]
public bool Enabled
{
get { return this["enabled"].ToString().ToLower() == "true" ? true : false; }
}
[ConfigurationProperty("header")]
public string header
{
???
}
}
それは私が(上記のコードでは、ヘッダーのプロパティ)要素で行うのですか、どのような属性で動作します?
あなたはあなたが対象とする.Netのバージョンを指定していません。上記のすべてのバージョンでは、.Net 1.1の[重要な発言](http://msdn.microsoft.com/en-us/library/system.configuration.iconfigurationsectionhandler(v = vs.110).aspx)は、IConfigurationSectionHandlerが.NET Framework 2.0以降では使用されなくなりました。 –