Hi folks I am fairly new to C# advanced topics. This is what I am trying to do.. Get Facebook friends data and insert into db. For getting the friends from FB, i am using json.
url = "htt开发者_开发问答ps://graph.facebook.com/me/friends?fields=id,name,picture,link&access_token=" + oAuth.Token;
json = oAuth.WebRequest(oAuthFacebook.Method.GET, url, String.Empty);
Friends frnds = js.Deserialize<Friends>(json);
Now how do I insert this frnds in the database I have the following class file Friends.cs
namespace TestConnect
{
public class Friends
{
public List<Friend> data { get; set; }
}
public class Friend
{
public string name { get; set; }
public string id { get; set; }
public string picture { get; set; }
public string link { get; set; }
}
}
Now if I do foreach(Friends lf in data)
foreach has a getenumerator missing error
Please suggest some way..Not sure if I am complicating it.. which I tend to do sometimes
Thanks SC
If data
in your example is the Friends
member data
then try this:
foreach(Friend f in frnds.data)
{
}
精彩评论