我正在尝试获取 SkyDrive 上已登录用户的所有文件夹的列表。
LiveOperationResult operationResult = await client.GetAsync("me/skydrive/files");
dynamic result = operationResult.Result;
我希望能够做这样的事情:
Dictionary<string, object> folderData = (Dictionary<string, object>)result;
List<object> folders = (List<object>)folderData["data"];
foreach (object item in folders)
{
Dictionary<string, object> folder = (Dictionary<string, object>)item;
if (folder["name"].ToString() == "Folder Name")
{
showToastMessage(folder["id"].ToString());
return;
}
}
但是,在这一行:
Dictionary<string, object> folderData = (Dictionary<string, object>)result;
我收到一个错误:
无法将类型“System.Dynamic.DynamicObject”转换为“System.Collections.Generic.Dictionary”
有谁知道我该如何解决这个问题?