Getting Node Value using XElement

If you have used Xml api in previous versions of C#, you must have felt the pain to extract node value and cast it to the correct type. With C# 3.0 new xml api, getting Node value is as simple as casting the node to the right type. You can still use the old fashioned XmlConvert class and convert the value to the right type by passing in the Value property of the node to get to the node value. Here is an example that illustrates how easy it is to convert xml node value to the right type.

image

image

No Comments