I got help on reading XML file (Help parsing XML with C#).
Having issues where for example some "controls" may have fewer parameters. I know I can use "if(control.attributes.interrupt.value != null)" before each ConsoleWrite.
Looking for a more elegant way to do this. Preferably in a single line. So if the parameter is null it is not printed and the process continues.
if (control.attributes.interrupt != null)
Console.Write($"\t{control.attributes.interrupt.value}");
else
Console.Write("\t");
Repeating this for each parameter. I was wondering/looking for a better/elegant way of doing this, as there are 40 or so values I want to write to the console.
Open in new window
I get System.NullReferenceException: 'Object reference not set to an instance of an object.' message.Even tried
Open in new window
Same thing. Clearly not handling the exception right. Now I'm lost.