Note that there are some explanatory texts on larger screens.

plurals
  1. PODeserialize a xml
    primarykey
    data
    text
    <p>I need to create an object that can be deserialised from this XML</p> <pre><code> &lt;Item&gt; &lt;Description&gt;Timber(dry)&lt;/Description&gt; &lt;Measure Type="VOLUME"&gt; &lt;Value&gt;1.779&lt;/Value&gt; &lt;Units&gt;m3&lt;/Units&gt; &lt;/Measure&gt; &lt;Measure Type="WEIGHT"&gt; &lt;Value&gt;925.08&lt;/Value&gt; &lt;Units&gt;Kilogram&lt;/Units&gt; &lt;/Measure&gt; &lt;Measure&gt; &lt;Value&gt;1&lt;/Value&gt; &lt;Units&gt;Units&lt;/Units&gt; &lt;/Measure&gt; &lt;/Item&gt; </code></pre> <p>My Problem is the <strong>Measure</strong>, it needs to be a list of some sort but when i create a list it serialises incorrectly</p> <pre><code> &lt;Item&gt; &lt;Description&gt;Timber(dry)&lt;/Description&gt; &lt;Measures&gt; &lt;--- Dont want this &lt;Measures&gt; tag &lt;Measure Type="VOLUME"&gt; &lt;Value&gt;1.779&lt;/Value&gt; &lt;Units&gt;m3&lt;/Units&gt; &lt;/Measure&gt; &lt;Measure Type="WEIGHT"&gt; &lt;Value&gt;925.08&lt;/Value&gt; &lt;Units&gt;Kilogram&lt;/Units&gt; &lt;/Measure&gt; &lt;Measure&gt; &lt;Value&gt;1&lt;/Value&gt; &lt;Units&gt;Units&lt;/Units&gt; &lt;/Measure&gt; &lt;/Measures&gt; &lt;--- &lt;/Item&gt; </code></pre> <p>This is what i have so far </p> <pre><code>public class Item { public Item() { this.Measures = new List&lt;Measure&gt;(); } public string Description { get; set; } public List&lt;Measure&gt; Measures { get; set; } } public class Measure { public string Value { get; set; } public string Units { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()] public string Type { get; set; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload