Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

How to set nullable property to anonymous

$
0
0

How do i set the properties of "result" to nullable int. The code below doesnt work

<Package><Document><ID>0</ID><UID/><SequenceNumber>0</SequenceNumber></Document><Document><ID/><UID/><SequenceNumber>1</SequenceNumber></Document><Document><ID>2</ID><UID/><SequenceNumber/></Document></Package>

static void Main(string[] args) { var result = XDocument.Parse(GetXml()).Root.Elements() .Select(x => new {

//this doesnt work ID = (int?)(x.Element("ID")), UID = (int?)(x.Element("UID")), SequenceNumber = (int?)(x.Element("SequenceNumber")), }).ToList(); }




Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>