Xin vui lòng trợ giúp. Tôi gặp lỗi khi đang deserializing dữ liệu từ máy chủ,Phần tử XML có tên 'tên' từ tham chiếu không gian tên các loại riêng biệt
Phần tử XML 'Tên' từ trên không gian tên '' tham chiếu các loại riêng biệt Object1.LocalStrings và System.String. Sử dụng các thuộc tính XML để chỉ định một tên hoặc không gian tên XML khác cho phần tử hoặc các loại.
Tôi có loại ObjectType có chứa các thuộc tính Tên và List<SupportedIp>
. Lớp SupportedIp cũng chứa tên thuộc tính. Vui lòng tham khảo mã của tôi dưới đây:
[XmlRootAttribute("SupportedIp", Namespace = "http://test.com/2010/test", IsNullable = false)]
public partial class SupportedIp
{[XmlElementAttribute(Namespace = "")]
public string Name
{
get;
set;
} .... }
[GeneratedCodeAttribute("xsd", "2.0.50727.1432")]
[SerializableAttribute()]
[DebuggerStepThroughAttribute()]
[DesignerCategoryAttribute("code")]
[XmlTypeAttribute(Namespace = "http://test.com/2010/test")]
[XmlRootAttribute("ObjectType", Namespace = "http://test.com/2010/test", IsNullable = false)]
public partial class ObjectType
{
/// <remarks/>
[XmlElementAttribute(ElementName = "", Namespace = "")]
public LocalStrings Name
{
get;
set;
}
/// <remarks/>
[XmlArrayAttribute(ElementName = "Supportedip", Namespace = "")]
[XmlArrayItemAttribute(IsNullable = false, Namespace = "")]
public List<Supportedip> Supportedip
{
get;
set;
}
}
Khi ứng dụng đạt đến XmlSerializer phần, hiển thị lỗi. Tôi đã nhìn thấy một số bài viết liên quan nhưng không có câu trả lời trùng nhau.