Help with GetFriends()

Mar 13, 2014 at 8:18 PM
Edited Mar 13, 2014 at 8:19 PM
Hi,

Sorry to bother you with what's probably a simple answer but I'm trying to retrieve a list of a users friends but the function is returning me an Enum, I'm really unsure what to do with it, I thought Enum's were constants and not something that would change depending on the user (in this case)

I'm using

var user = User.GetUserFromScreenName(username);
var show = user.GetFriends();

Which returns an IEnumerable, Which I can't iterate through, I expected it to return a list but this has stumped me.

Just a FYI I'm a hobbyist trying c# for the second time (First was little bits in Unity2d)

Any help would be appreciated

Thank you

Bry
Coordinator
Mar 13, 2014 at 8:29 PM
Hi,

An IEnumerable is not an Enum, it is a 'List' that you cannot modify. If you are more used to play with List just do the following.

First add the following namespace at the top of your file:
using System.Linq;
var user = User.GetUserFromScreenName(username);
var friends = user.GetFriends().ToList();
Done, you have you list of friends :)

Regards,
Linvi
Marked as answer by linvi on 3/13/2014 at 3:02 PM
Mar 13, 2014 at 8:34 PM
Aah right that clears it up, thank you very much.

Also thank you for the library :)