【发布时间】:2015-01-18 04:11:16
【问题描述】:
我的工具从 XML 生成了一个代码,在里面我可以看到,但看不懂
[System.Xml.Serialization.XmlElementAttribute("Request", typeof(RequestType), Order = 0)]
[System.Xml.Serialization.XmlElementAttribute("Response", typeof(ResponseType), Order = 0)]
public object Item
{
get
{
return this.itemField;
}
set
{
if ((this.itemField != null))
{
if ((itemField.Equals(value) != true))
{
this.itemField = value;
this.OnPropertyChanged("Item");
}
}
else
{
this.itemField = value;
this.OnPropertyChanged("Item");
}
}
}
为什么类型是对象,然后如何知道它是什么类型继续处理?
【问题讨论】:
-
您可能在 XSD 中做了一些不能很好地转换为 C# 的操作...检查名称为“请求”和“响应”的元素。问问自己:代码应该如何生成?如何更改 XSD 以使生成的代码更加面向对象?
-
另外,请发布 XSD...
-
你是用它来调用网络服务吗?
-
是的,我无法更改 XSD
标签: c# .net xml oop properties