我希望使用正常的早期绑定数据类型来编写代码,而不是使用动态(或var)。但是,为了枚举
foreach (var item in fbFeed.data) 要求fbFeed是具有属性“data”的类型。
var fb = new Facebook.FacebookClient(longlifeaccess_token);
dynamic fbFeed = fb.Get("me/feed");
foreach (var item in fbFeed.data)
{
var thepost = (IDictionary<string, object>)item;
Console.WriteLine("ID {0}", thepost["id"].ToString());
}如果我不想使用var或dynamic,那么对于上述代码中的fbFeed和item,我应该使用什么数据类型。
发布于 2014-04-22 16:23:51
我觉得这应该很接近
Facebook.FacebookClient fb = new Facebook.FacebookClient(longlifeaccess_token);
Facebook.JsonObject feFeed = (Facebook.JsonObject)fb.Get("me/feed");
Facebook.JsonArray feFeedData = (Facebook.JsonArray)feFeed["data"];
foreach (Facebook.JsonObject item in feFeedData)
{
IDictionary<string, object> post = (IDictionary<string, object>)item;... ...
https://stackoverflow.com/questions/23221481
复制相似问题