views:

31

answers:

1
var response = _facebookAPI.Fql.Query(String.Format("SELECT uid FROM event_member WHERE eid={0}", myevent));

I would like to convert response to

List<long> uids

A: 

Assuming that the string returned is an XMLDocument:

var response = _facebookAPI.Fql.Query(String.Format("SELECT uid FROM event_member WHERE eid={0}", myevent));
XmlDocument doc = new XmlDocument(); 
doc.LoadXml(response); 
XmlNodeList uids = doc.GetElementsByTagName("uid"); 

var uids = new List<long>();
foreach (XmlNode node in uids)
{
      long id;
      if (long.TryParse(node.InnerText, out id))
      {
           uids.Add(id);
      }
 } 
Daniel Dyson
I believe Tom mentioned in an earlier comment (now deleted) that the response is an XML string.
Tim S. Van Haren
Thanks @Tim. I have updated my answer to reflect this
Daniel Dyson