Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Comparing lists of GetFriends() and GetFollowers()

$
0
0
Hello again,

I've come up with a problem that I have tried to solve myself and through asking on StackExchange,


I am trying to compare the list of friends against the list of followers and display the difference, in this case the people who are you following but aren't following you using :
var friends = user.GetFriends(500).ToList();
            var following = user.GetFollowers(500).ToList();
            var result = compareFollowingtoFollowers(friends, following);
            foreach(var res in result)
            {
                lstFollowerChecker.Items.Add(res);
            }
 private List<T> compareFollowingtoFollowers<T>(List<T> friends, List<T> followers)
        {

            var results = friends.Except(followers).ToList();
            return results;
        }
From what has been explained to me from the StackExchange question

The User class needs to implement IEquatable, because it's seeing the objects returned as the all different objects so it's returning them all.

My question is does Tweetinvi already do this and I'm just being dense again or will I need to (learn to) override the User class from the library and implement IEquatable?

Thank you for reading, I appreciate any help being a self/Internet Based taught person.

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>