I'm accessing this method using WPF. I know that when accessing objects from an outside method, I should use a Dispatcher. Or the "node" is a local variable and it is giving me:
Object reference not set to an instance of an object.
Why?
Here's the Code:
SpeechSynthesizer valery = new SpeechSynthesizer();
XmlDocument xmlNews = new XmlDocument();
xmlNews.Load(string.Format("http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&topic=tc&output=rss"));
foreach (XmlNode node in xmlNews.SelectNodes("/rss/channel/item"))
{
valery.Speak(node.SelectSingleNode("/title").InnerXml);
}