如何在列表框中撤消ListFollower?

时间:2016-01-29 20:43:18

标签: c# tweetsharp

使用TweetSharp我正在计算关注者列表。如何将其撤回ListBox

以下是代码:

var options = new ListFollowerIdsOfOptions() { ScreenName = "PutinRF" };
do
{
    if (cursor != null)
      options.Cursor = cursor;

    var followersList = ts.ListFollowerIdsOf(options);

    //listBox1.Items.AddRange(followersList.ToArray());

    cursor = followersList.NextCursor;

} while (cursor != 0);

2 个答案:

答案 0 :(得分:1)

尝试使用DataSource property

listBox1.DataSource = followersList;

或查看以下实施:

var allIds = new List<long>();
var options = new ListFollowerIdsOfOptions() { ScreenName = "PutinRF" };
var followersIds = ts.ListFollowerIdsOf(options);
while (followersIds.NextCursor != 0)
{
   options.Cursor = followersIds.NextCursor;
   allIds.AddRange(followersIds);
}
listBox1.DataSource = allIds;

答案 1 :(得分:0)

我的决定:

            var options = new ListFollowerIdsOfOptions { ScreenName = "PutinRF" };
            List<long> All_ods = new List<long>();
            TwitterCursorList<long> followerIDS = ts.ListFollowerIdsOf(options);
            while(followerIDS.NextCursor!=null)
            {
                options.Cursor = followerIDS.NextCursor;

                All_ods.AddRange(followerIDS.ToArray());
                //listBox1.Items.Add(All_ods.ToArray());
                listBox1.DataSource = All_ods;
                label1.Text = "Получено: " + listBox1.Items.Count.ToString();
                break;  
            }