My docs have attributes called "order", with a default value of 1. So if
there is no "order" attribute, the program shall use the value 1.
Implementing this with XmlTextReader was harder than expected. Since
GetAttribute() returns null if the attribute isn't found, and null can
be interpreted as false, I thought this would do it:
decimal order = 1;
if (r.GetAttribute("order"))
order = Convert.ToDecimal(r.GetAttribute("order"));
I get the error:
Cannot implicitly convert type 'string' to 'bool'
What's the right way to do it?
Gustaf