c#: xdocument and reading xsi:nil="true" gives "String was not recognized as a valid DateTime"

Posted by DingoCC on Stack Overflow See other posts from Stack Overflow or by DingoCC
Published on 2011-03-08T03:50:01Z Indexed on 2011/03/09 0:10 UTC
Read the original article Hit count: 221

Filed under:
|

Happily reading xml with

var q2 = from c in xmlDoc.Descendants("Ticket")
                 select new
              { Responded_Date = (DateTime)c.Element("Responded_Date") }

However when the tag is

<Responded_Date xsi:nil="true" />

I get "String was not recognized as a valid DateTime". I don't wish to use the null coalescing operator but simply to take the null and insert into datatable

© Stack Overflow or respective owner

Related posts about c#

Related posts about xdocument