高分,请您给看这个私有变量是从哪来的。100分,100分。
.net2.0 自定义配置节 (处理自定义配置文件)
文件来源是:
http://www.cnblogs.com/luoxiao/archive/2007/08/03/842199.html
public class MyBookShopConfigurationElement : ConfigurationElement
{
public MyBookShopConfigurationElement(String key, String value)
{
this.Key = key;
this.Value = value;
}
public MyBookShopConfigurationElement()
{
}
[ConfigurationProperty( "key ", DefaultValue = " ", IsRequired = true, IsKey = true)]
public string Key
{
get
{
return (string)this[ "key "];
}
set
{
this[ "key "] = value;
}
}
[ConfigurationProperty( "value ", DefaultValue = " ", IsRequired = true)]
//[RegexStringValidator(@ "\w+:\/\/[\w.]+\S* ")]
public string Value
{
get
{
return (string)this[ "value "];//这是这个,这个私有变量是哪 来的??
}
set
{
this[ "value "] = value;
}
}
}
[解决办法]
这个不是变量,是配置文件里的一个节点,大概就是这样:
<add name= " " valur= " " key= " "/>
[解决办法]
继承config自动从文件生成的属性
[解决办法]
所谓自定义配置,就是自己来控制的,
http://msdn2.microsoft.com/zh-cn/library/system.configuration.configurationsection%28VS.80%29.aspx
你也可以写成
public string Value
{
get
{
return (string)this[ "AAA "];//这是这个,这个私有变量是哪 来的??
}
set
{
this[ "AAA "] = value;
}
}
[解决办法]
this[]
摘要:
获取或设置此配置元素的属性 (Property) 、属性 (Attribute) 或子元素。
参数:
propertyName: 要访问的 System.Configuration.ConfigurationProperty 的名称。
返回值:
指定的属性 (Property)、属性 (Attribute) 或子元素。
[解决办法]
已在
http://community.csdn.net/Expert/topic/5711/5711624.xml?temp=.1750299
回复
BTW, 钻石还不够闪耀 :)