如何将其转换为在.NET 3.5中工作?由于某种原因,它无法编译...... 抱怨“myInfo.data”缺少.NET 4.0中使用的Microsoft CSharp引用。
var auth = new CanvasAuthorizer { Perms = "user_about_me,friends_about_me" };
if (auth.Authorize())
{
var fb = new FacebookClient(auth.Session.AccessToken);
dynamic myInfo = fb.Get("/me/friends");
foreach (dynamic friend in myInfo.data )
{
Response.Write("Name: " + friend.name + "<br/>Facebook id: " + friend.id + "<br/><br/>");
}
}
答案 0 :(得分:1)
大概是这样的:
var auth = new CanvasAuthorizer { Perms = "user_about_me,friends_about_me" };
if (auth.Authorize())
{
var fb = new FacebookClient(auth.Session.AccessToken);
MyInfoType myInfo = (MyInfoType)fb.Get("/me/friends");
foreach (var friend in myInfo.data)
{
Response.Write("Name: " + friend.name + "<br/>Facebook id: " + friend.id + "<br/><br/>");
}
}
fb.Get返回什么类型?