I have a if-else if construct where in I am setting a particular value of a variable based on the XName Element local name as follows:
if (element.Name.LocalName == "b036") //"b036" is a XML element tag name
object.rawValue = (element.Value.Trim()); //note rawvalue is of string type
else if (element.Name.LocalName == "b037")
object.rawValue = (element.Value.Trim());
else if (element.Name.LocalName == "b040")
object.rawValue = (element.Value.Trim());
So what i want to do is following:-
b036, PersonName (e.g., John Smith) if not available use b037
b037, PersonName (e.g., Smith, John) if not available use b040
b040, KeyNames, a.k.a Last Name (e.g., Smith)
If none of b036, b037 or b040 are found, I do not want to set the "rawvalue" for that record
How can I construct my if-else statements or should I use switch case statements to achieve the same?
Aucun commentaire:
Enregistrer un commentaire