title: Cannot convert string to DateTime within a LINQ expression
body: <p>I am using a LINQ to XML expression to deserialize some XML data into a list of objects. My object is simply a collection fields:</p>
  
  <pre><code>public class DataObject
  {
   private string Name { get; set; }
   private DateTime Date { get; set; }
  } 
  </code></pre>
  
  <p>And here's the LINQ query:</p>
  
  <pre><code>XDocument linqXml = XDocument.Parse(dataToDeserialize.OuterXml)
  List&lt;DataObject&gt; MyObjects = (from object in linqXml.Descendants("object")
  select new DataObject
  {
   Name = object.Element("Name").Value,
   Date = Convert.ToDateTime(object.Element("Date").Value)
  } 
  </code></pre>
  
  <p>When I run this, the LINQ query throws a FormatException: "String was not recognized as a valid DateTime."</p>
  
  <p>The date string in the XML is formatted in UTC: 2013-05-02T11:25:35-06:00</p>
  
  <p>To test I tried a conversion of the date time and it correctly returns the DateTime object.</p>
  
  <pre><code>DateTime dt = Convert.ToDateTime("2013-05-02T11:25:35-06:00");
  </code></pre>
  
  <p>And the string properly converts to a new DateTime object. If I switch the date field on my object to a string type, and then convert it in another method, it converts. It just seems not to work when part of the LINQ query.</p>
  
  <p>I'm stumped on this one. I've tried using DateTime.Parse(string) as well, but that throws the same exception. Is there any way to do this conversion within the query or do I have to convert the fields after the objects have been created?</p>
  
  <p>Edited to add:</p>
  
  <p>Sample XML:
  The attributes in each tag are generated by the transaction engine I'm querying to get this data. I pulled the text of the XML while debugging and there appears to be no additional whitespace between the Date tags.</p>
  
  <pre><code>&lt;Object&gt;
   &lt;Name __genericType="String" __specificType="[String]" __nodeType="DataField"&gt;HelloThere&lt;/Name&gt;
   &lt;Date __genericType="Timestamp" __specificType="[TimeStamp]" __nodeType="DataField"&gt;2013-05-12T11:08:04-06:00&lt;/Date&gt;
  &lt;/Object&gt;
  </code></pre>