Question

I am trying to get n followers where n could be 1,2,3,4 etc.. By default Linq To Twitter return all the followers. Is there any way I can define how many followers I need? My current code look like this

var followers = twitterCtx.Friendship
                   .Where(f => f.Type == FriendshipType.FollowersList
                       && f.UserID == twitterUserId.ToString())
                   .Select(f => new TwitterData()
                         {

                            Followers = f.Users.Where(t => t.Protected == false).Select(s => s).ToList()
                          ).FirstOrDefault();

Please suggest

Was it helpful?

Solution

Followers = f.Users.Where(t => !t.Protected).Take(n).ToList()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top