xml:
<?xml version="1.0" encoding="UTF-8"?>
<section id="" >
<name/>
<section id="">
<name/>
</section>
</section>
实例化后:
[XmlRoot(ElementName = "section", IsNullable = false), Serializable]
public partial class section
{ [XmlAttribute(AttributeName = "id", DataType = "string")]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public string __id; [XmlIgnore]
public string id
{
get { return __id; }
set { __id = value; }
} [XmlElement(ElementName = "name", IsNullable = false, Form = XmlSchemaForm.Qualified, DataType = "string")]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public string __name; [XmlIgnore]
public string name
{
get { return __name; }
set { __name = value; }
} [XmlElement(Type = typeof(ePubLib.section), ElementName = "section", IsNullable = false, Form = XmlSchemaForm.Qualified)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public ePubLib.section __section; [XmlIgnore]
public ePubLib.section section
{
get
{
if (__section == null) __section = new ePubLib.section();
return __section;
}
set { __section = value; }
} public section()
{
}
}编译的时候,总是提示:
section:成员名称不能与它们的封闭类型相同
<?xml version="1.0" encoding="UTF-8"?>
<section id="" >
<name/>
<section id="">
<name/>
</section>
</section>
实例化后:
[XmlRoot(ElementName = "section", IsNullable = false), Serializable]
public partial class section
{ [XmlAttribute(AttributeName = "id", DataType = "string")]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public string __id; [XmlIgnore]
public string id
{
get { return __id; }
set { __id = value; }
} [XmlElement(ElementName = "name", IsNullable = false, Form = XmlSchemaForm.Qualified, DataType = "string")]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public string __name; [XmlIgnore]
public string name
{
get { return __name; }
set { __name = value; }
} [XmlElement(Type = typeof(ePubLib.section), ElementName = "section", IsNullable = false, Form = XmlSchemaForm.Qualified)]
[EditorBrowsable(EditorBrowsableState.Advanced)]
public ePubLib.section __section; [XmlIgnore]
public ePubLib.section section
{
get
{
if (__section == null) __section = new ePubLib.section();
return __section;
}
set { __section = value; }
} public section()
{
}
}编译的时候,总是提示:
section:成员名称不能与它们的封闭类型相同
解决方案 »
- 如何把DS中两个结构相同的表的数据更新成一样?
- 高分求助:高手请进,C#调用ExitWindowsEx异常问题
- c# winform 连远程数据库问题
- DataGridView怎么不选中一整行数据就可以取其中一个单元格的值
- 怎么自动登陆网页
- VS打包超级难题:如何按照顺序一个接一个安装exe(顶有分,一定要解决!)
- 相对路径问题
- C#里有没有基类访问自己子类的方法(除了子类的方法用static修饰以外的)
- 弱弱的问:怎么实现指针
- 初学者:安装问题求救,我都装了一上午了还是不行,救救我吧!
- Google Map的aps.net自定义控件(留E-mail,给源码)
- 用csc编译的不解,为何命令行中不用加 /r:system.windows.forms.dll 就可以编译呢?
<?xml version="1.0" encoding="UTF-8"?>
<section id="" >
<name/>
<section id="">
<name/>
</section>
</section>
改成
xml:
<?xml version="1.0" encoding="UTF-8"?>
<section id="" >
<name/>
<section id=""> </section>
<name/>
</section>
类名: section
属性: [XmlIgnore]
public ePubLib.section section
{
get
{
if (__section == null) __section = new ePubLib.section();
return __section;
}
set { __section = value; }
}
属性名称不能与类名相同。