title: Linq to Xml - Empty Element
body: <p>I am parsing an xml doc with Linq, but i am running into a scenario where I am not sure how to handle the processing.  Everything I have found / tried doesn't seem to work.  As you can see below (very simple scenario) where the OrderAmount is empty.  This is a decimal field.  When I try to handle this in LINQ it keeps bombing.  I have tried using deimcal?, using the null check, etc nothing seems to be working (Most likely user error).  Any suggestions would be appreciated. </p>
  
  <p>How do you handle when an element is a non string (like a decimal) and is empty  ?</p>
  
  <p>Xml:</p>
  
  <pre><code>&lt;Orders&gt;
    &lt;Order&gt;
      &lt;OrderNumber&gt;12345&lt;/OrderNumber&gt;
      &lt;OrderAmount/&gt;
    &lt;/Order&gt;
  &lt;/Orders&gt;
  </code></pre>
  
  <p>LINQ:</p>
  
  <pre><code>List&lt;Order&gt; myOrders = from orders in xdoc.Descendants("Order")
                         select new Order{
                         OrderNumber = (int)orders.Element("OrderNumber"),
                         OrderAmount = (decimal?)orders.Element("OrderAmount"),
  
  
  }.ToList&lt;Order&gt;();
  </code></pre>