Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I copied your code and directly pasted it into a console application. It works exactly as expected.</p> <p><img src="https://i.stack.imgur.com/K3E1c.png" alt="enter image description here"></p> <p>Is there anything else that you can show us that might have an effect on the results?</p> <p>Here is the complete sample I used, in case you are doing something different...</p> <pre><code>string xml = @"&lt;?xml version='1.0' encoding='utf-8' ?&gt; &lt;object&gt; &lt;body&gt;tests&lt;/body&gt; &lt;send_results type='null' /&gt; &lt;note_class&gt;none&lt;/note_class&gt; &lt;users type='list' /&gt; &lt;title&gt;test&lt;/title&gt; &lt;time_sent type='null' /&gt; &lt;image type='null' /&gt; &lt;to_customers type='boolean'&gt;False&lt;/to_customers&gt; &lt;time_created&gt;2013-06-26T16:40:50&lt;/time_created&gt; &lt;num_sends type='integer'&gt;0&lt;/num_sends&gt; &lt;time_scheduled type='null' /&gt; &lt;dealership&gt;/api/v1/dealerships/10/&lt;/dealership&gt; &lt;id type='integer'&gt;22&lt;/id&gt; &lt;send_rate&gt;none&lt;/send_rate&gt; &lt;send_method&gt;email&lt;/send_method&gt; &lt;reply_to_email&gt;do_not_reply@williamson-cadillac.com&lt;/reply_to_email&gt; &lt;response_link type='null' /&gt; &lt;to_users type='boolean'&gt;True&lt;/to_users&gt; &lt;resource_uri&gt;/api/v1/notifications/22/&lt;/resource_uri&gt; &lt;/object&gt;"; var parsedXml = XDocument.Parse(xml); var query = from m in parsedXml.Descendants("object") select new Notifications { Body = (string)m.Element("body"), SendResults = (string)m.Element("send_results"), NoteClass = (string)m.Element("note_class"), Users = m.Element("users").Elements().Select(e =&gt; (string)e.Element("value")).ToList(), Title = (string)m.Element("title"), TimeSent = (string)m.Element("time_sent"), Image = (string)m.Element("image"), ToCustomers = (string)m.Element("to_customers"), TimeCreated = (string)m.Element("time_created"), NumSends = (string)m.Element("num_sends"), TimeScheduled = (string)m.Element("time_scheduled"), Dealership = (string)m.Element("dealership"), Id = (string)m.Element("id"), SendRate = (string)m.Element("send_rate"), SendMethod = (string)m.Element("send_method"), ReplyToEmail = (string)m.Element("reply_to_email"), ResponseLink = (string)m.Element("response_link"), ToUsers = (string)m.Element("to_users"), ResourceUri = (string)m.Element("resource_uri"), }; Console.WriteLine("Number of items = {0}, {1}",query.Count(), query.FirstOrDefault().Body); Console.ReadLine(); </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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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