<configuration>
<configSections>
<sectionGroup name="loggingConfigs">
<section name="LoggingParameters"
type="Framework.Logging.LoggingParameters, Framework.Logging" />
</sectionGroup>
</configSections>
<loggingConfigs>
<LoggingParameters
myconfig="C:mydir\mypath1\mypath2\log4net.config"
/>
</loggingConfigs>
</configuration>
public class LoggingParameters : ConfigurationSection
{
[ConfigurationProperty("myconfig", IsRequired = true)]
private string ConfigFileLoc
{
get { return (string)this["myconfig"]; }
}
public FileInfo MyConfigFile
{
get
{
string s = ConfigFileLoc; <--- getting empty string here..don't know why
return new FileInfo(s);
}
}
}
アプリケーションの他の場所で次の呼び出しを行うと、
FileInfo f = new Framework.Logging.LoggingParameters().MyConfigFile;
ConfigFileLoc は常に空白として返されます。なぜその空白なのかわかりません..なぜ文字列が空なのか..助けてください。