基于通过序列化另一个 C# 类生成的 XML 创建 *.cs (C# 类) 时遇到问题。XSD.exe 抛出以下错误:
- A column named 'Conditions' already belongs to this DataTable: cannot set a
nested table name to the same name.
我的过程如下所示:
- 编写一些 C# 代码(下面的示例)
- 序列化为 XML 使用 XSD.EXE
- 创建 *.cs 反序列化为新的 *.cs
- (用于运输)等
序列化为 XML 的类(在第 1 点中)如下所示:
public class A
{
public A(){}
private List<string> _cond = new List<String>();
public List<string> Conditions
{
get{ return _cond; }
set{ _cond = value }
}
}
public class B:A
{
}
public class C:A
{
}
public class Data
{
B b = new B();
C c = new C();
/* ... ADD SOME DATA etc ... */
}
// After that I serialize to XML the "Data" class object
任何人都可以建议解决方法吗?!这显然是由继承的条件属性引起的