consider the part of xml file.
<Element>Value</Element>
i used XmlTextReader to read xml file. so i used while(reader.Read())
now when i reach Element
i want to get its Value.
if(reader.NodeType == XmlNodeType.Element && reader.LocalName == "Element")
{
reader.Read();
var var = reader.Value;
}
is there any way to combine this two lines? a single expression equals to:
reader.Read();
var var = reader.Value;
Note that i dont want to skip into Element. i am using XmlTextReader and i read xml line by line.
the only reason is to keep the code simple. i feel better if this be possible.
You could just create an extension method
Usage: