Vì vậy, tôi có một xml có cấu trúc tương tự như sau:C# phần deserialization
<MyObject>
<PropertyA>Value</PropertyA>
<PropertyB>Value</PropertyB>
<PropertyC>Value</PropertyC>
<ArrayOfOtherObject>
<OtherObject>
<PropertyX>Value</PropertyX>
<PropertyY>Value</PropertyY>
<PropertyZ>Value</PropertyZ>
</OtherObject>
<OtherObject>
<PropertyX>Value</PropertyX>
<PropertyY>Value</PropertyY>
<PropertyZ>Value</PropertyZ>
</OtherObject>
<OtherObject>
<PropertyX>Value</PropertyX>
<PropertyY>Value</PropertyY>
<PropertyZ>Value</PropertyZ>
</OtherObject>
</ArrayOfOtherObject>
</MyObject>
Có cách nào mà tôi có thể deserialize MyObject nhưng không phải là ArrayOfOtherObject? Và sau đó làm một tải chậm của ArrayOfOtherObject khi cần thiết?
Tôi thường sử dụng XmlDeserialization, nhưng AFAIK nó luôn tải toàn bộ.
Cảm ơn!
Thành thật mà nói, trừ khi khối lượng dữ liệu là rất lớn bạn sẽ khấm khá hơn sẽ cho cách tiếp cận đơn giản nhất, và deserialize tất cả. –
+1 câu hỏi tốt Carlo – toddmo