如何使用TweetSharp API关注用户

时间:2013-12-03 18:54:40

标签: c# tweetsharp

我正在使用TweetSharp API,我需要关注C#List中的人,但是,我遇到了麻烦。适当的代码如下:

var results = service.Search(new SearchOptions {Q = hashtag}); //hashtag string entered by user
List<decimal> users = new List<decimal>();

foreach (var tweet in results.Statuses)
{
    users.Add(tweet.User.Id);
}

foreach (decimal user in users)
{
    service.FollowUser(user);  //follow each user, the issue is here. 
}

显然我使用了无效的论据。

1 个答案:

答案 0 :(得分:0)

FollowUser方法将FollowUserOptions类型作为参数,而不是小数。试试这个:

foreach (var user in users)
{
    var options = new FollowUserOptions
    {
        UserId = user
    };

    service.FollowUser(options);
}