我正在使用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.
}
显然我使用了无效的论据。
答案 0 :(得分:0)
FollowUser
方法将FollowUserOptions
类型作为参数,而不是小数。试试这个:
foreach (var user in users)
{
var options = new FollowUserOptions
{
UserId = user
};
service.FollowUser(options);
}