Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 调用IsolatedStorage.Load方法(Windows Phone 8)时出错_C#_Windows Phone 8_Isolatedstorage - Fatal编程技术网

C# 调用IsolatedStorage.Load方法(Windows Phone 8)时出错

C# 调用IsolatedStorage.Load方法(Windows Phone 8)时出错,c#,windows-phone-8,isolatedstorage,C#,Windows Phone 8,Isolatedstorage,我正在Windows Phone 8中的存储中查找写入对象 一切都很好,但当我调用Load方法时:IsolatedStorageOperations.Load(“myXML.xml”) 我总是会出错: Cannot implicitly convert type 'System.Threading.Tasks.Task <'friendsbook.Lib.Friend'>' to 'friendsbook.Lib.Friend'

我正在Windows Phone 8中的存储中查找写入对象

一切都很好,但当我调用Load方法时:
IsolatedStorageOperations.Load(“myXML.xml”)

我总是会出错:

Cannot implicitly convert type 'System.Threading.Tasks.Task 
                          <'friendsbook.Lib.Friend'>' to 'friendsbook.Lib.Friend'
但是调用Save方法没有问题

有人能帮我解决这个问题吗


谢谢。

IsolatedStorageOperations.Load方法是异步的,调用时使用
Wait
关键字:

var friend = await IsolatedStorageOperations.Load<Friend>("myXML.xml");
var-friend=wait isolatedstoraeperations.Load(“myXML.xml”);

谢谢您的回答!但是您只能在异步方法中使用wait。或者,您可以同步调用该方法:
var-friend=IsolatedStorageOperations.Load(“myXML.xml”).Result
var friend = await IsolatedStorageOperations.Load<Friend>("myXML.xml");