尝试从http://facebooksdk.blogspot.co.uk/2011/04/facebook-groups.html运行代码时出现以下错误
错误是“Invalid CastException Was Unhandled”和“Specified Cast Is Not Valid”
我正在使用 Facebook C# SDK,并且正在使用以下代码...
public Dictionary<string, string> GetGroups()
{
string accessToken = _accessToken;
FacebookClient facebookClient = new FacebookClient(accessToken);
JsonObject resul = facebookClient.Get("https://graph.facebook.com/me/groups?access_token=" + accessToken) as JsonObject;
Dictionary<string, string> dicGroups = new Dictionary<string, string>();
foreach (JsonObject item in (((KeyValuePair<string, object>)(resul[0])).Value as JsonArray))
{
comboBox1.Items.Add(item["id"].ToString());
}
return dicGroups;
}
有人可以帮忙吗?我正在尝试获取所有用户组的列表并将它们添加到组合框中。谢谢