1
OAuthTokens tokens = new OAuthTokens();
tokens.AccessToken = "188817262xxxxx";
tokens.AccessTokenSecret = "GNqhB1gkxxxx";
tokens.ConsumerKey = "Q6xxxxx";
tokens.ConsumerSecret = "2eZyxxxxxx";

var<TwitterUser> showUserResponse = TwitterUser.Show(tokens, "twitterUsername");
if (showUserResponse.Result == RequestResult.Success)
    {
    string screenName = showUserResponse.ResponseObject.ScreenName;
    Response.Write(screenName);
    Response.Write("<br>");
    Response.Write(showUserResponse.ResponseObject.NumberOfFollowers);
    }

使用此代码,我可以获得我的 TwitterscreenNamenumberOfFollowers,但我想screenName在我的 asp.net 应用程序上打印这些关注者。我怎样才能做到这一点?

FollowersOptions options = new FollowersOptions();
options.ScreenName = "wallace740";
TwitterResponse<TwitterUserCollection> followers = TwitterFriendship.Followers(options);

// Response.Write(followers.Content);

如何screenName从这个 JSON 中获取我的追随者的 s(followers.Content给我一个 JSON 结果)?

4

1 回答 1

1

您可以通过 ReponseObject 进行枚举。

        foreach (var follower in followers.ResponseObject)
        {
            follower.ScreenName;
        }
于 2012-11-27T07:49:04.283 回答