skydrive System.Dynamic.DynamicObject

夙愿已清 提交于 2019-12-01 21:18:32

The problem is that LiveOperationResult.Result isn't necessarily guaranteed to be a Dictionary<string, object>. It is however defined as an IDictionary<string, object>.

Mind you, you don't appear to even need to cast the Result property to a dictionary of any sort; you should be able to use the dynamic variable to directly access the list you want to iterate.

List<object> folders = (List<object>)result.data;

I think that you receive this because you have declared result using the following code

dynamic result = operationResult.Result;

this will declare result as a new System.Dynamic.DynamicObject so that, when we say

Dictionary<string, object> folderData = (Dictionary<string, object>)result;

You are trying to convert result of type System.Dynamic.DynamicObject to System.Collections.Generic.Dictionary which is not possible and that's why you receive the error.

Thanks,
I hope you find this helpful :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!