Hi I'm using twitterizer to get a list of friends for an authenticated user. After some successful iterations of the while loop. I get an invalidcastexception when I call ResponseObject.NextPage. I am stumped as to why I am getting the error. Can anyone see why?
Code below.
List<String> GetFriends(OAuthTokens tokens)
{
var result = new List<String>();
TwitterResponse<TwitterUserCollection> friendsResponse = TwitterFriendship.Friends(tokens);
if (friendsResponse.Result != RequestResult.Success)
{
return new List<string> {friendsResponse.ErrorMessage};
}
TwitterUserCollection friends = friendsResponse.ResponseObject;
while (friends != null)
{
result.AddRange(friends.Select(x => x.Name));
var y = friends.NextPage(); //ERROR HERE
friendsResponse = y;
if (friendsResponse.Result != RequestResult.Success)
{
return new List<string> {friendsResponse.ErrorMessage};
}
friends = friendsResponse.ResponseObject;
}
return result;
}
This looks like a bug... NextPage will be removed from the next version of Twitterizer http://forums.twitterizer.net/viewtopic.php?f=9&t=475