有点搞不懂,你贴出的代码已经可以实现了你要的功能了,只需要:
1.OrderStateTypeElement继承于ConfigurationElement,对每一个属性设置相关的特性如ConfigurationProperty等。如:
[ConfigurationProperty("status",
IsRequired = true)]
public string Status
{
get
{
return (string)this["status"];
}
set
{
this["status"] = value;
}
}
2.NotifySection继承于ConfigurationSection,同样设置相关特性
3.定义一个OrderStateType集合类,在NotifySection中会拥有一个该集合的属性:
[ConfigurationProperty("OrderStateTypes",
IsDefaultCollection = false)]
public OrderStateTypeCollection OrderStateTypes
{
get
{
OrderStateTypeCollection statetypes
(OrderStateTypeCollection )base["OrderStateTypes"];
return statetypes;
}
}