I was wondering if there is a syntax for puting a timer on a local variable that is using XmlTextReader, instead of generating a whole new method for the XmlTextReader? What I want to do is read an xml file and display the findings, but put restrictions on how long the XmlTextReader can read that file.
Loading
VulpesPosted Dec 9, 2014, 10:54 AM
Although it only saves a line, there is a way to create and start the Stopwatch at the same time:
Stopwatch sw = Stopwatch.StartNew();
Otherwise, by altering the while condition as you've done, you could just use standard XmlTextReader code such as this example on MSDN:
http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader.read(v=vs.110).aspx
MarcPosted Dec 9, 2014, 10:03 AM
stopwatch sw = new Stopwatch();
sw.Start();
while(reader.Read() && sw.Elaped < TimeSpan.FormSeconds(5))
{
//read xml file
}