KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a static method that in it I call async method (xmlHelper.LoadDocument()). and I call this method in a property at Setter section internal static IEnumerable<Word> LoadTenWords(int boxId) { XmlHelper xmlHelper = new XmlHelper(); XDocument xDoc = xmlHelper.LoadDocument().Result; return xDoc.Root.Descendants("Word").Single(...) } As you know LoadTenWord is static and cannot be a async method, so I call LoadDocument with Result property. When I run my app the application don't work but when I debug it and I wait in following line XDocument xDoc = xmlHelper.LoadDocument().Result; everything is ok!!! I think , without await keyword, C# doesn't wait for the process completely finished. do you have any suggestion for solving my problem?
Tags (comma-separated)
Save Edits
Cancel