如何让这些代码在.net 3.5中运行

本文关键字:net 运行 代码 | 更新日期: 2023-09-27 17:55:06

如何将其转换为。net 3.5中的工作?由于某种原因,它无法编译…抱怨"myInfo"。. 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/>");
    }
}

如何让这些代码在.net 3.5中运行

大致是:

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。得到回报?