EDN Admin
Well-known member
Is something wrong with the following code::
double? number = (double?)record.Element("Phone")
It works fine when Phone has a value but gives error when the element is empty in the xml like this <Phone />
Also if the Phone element is absent, then also the code works. <span style="font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; color:#333333; line-height:16px Why can I cast a non existing element to null, but
not an element which actually <span style="font-weight:inherit; font-style:italic; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; padding:0px; margin:0px; border:0px initial initial is null?
<
Pankaj Upadhyay
View the full article
double? number = (double?)record.Element("Phone")
It works fine when Phone has a value but gives error when the element is empty in the xml like this <Phone />
Also if the Phone element is absent, then also the code works. <span style="font-family:Segoe UI,Lucida Grande,Verdana,Arial,Helvetica,sans-serif; font-size:13px; color:#333333; line-height:16px Why can I cast a non existing element to null, but
not an element which actually <span style="font-weight:inherit; font-style:italic; font-family:inherit; outline-width:0px; outline-style:initial; outline-color:initial; padding:0px; margin:0px; border:0px initial initial is null?
<
Pankaj Upadhyay
View the full article