如何在列表框中撤回列表关注者

本文关键字:列表 | 更新日期: 2023-09-27 18:32:26

使用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);

如何在列表框中撤回列表关注者

尝试使用数据源属性:

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;

我的决定:

            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;  
            }