public static List<Comment> GetComments(Story story) { List<Comment> comments = new List<Comment>(); string url = string.Format(Globals.Base + "stories/{0}/comments?count={1}&appkey={2}", story.Id, Globals.Count, Globals.AppKey); XmlTextReader reader = Parser.CreateWebRequest(url); Comment newComment = new Comment(); while (reader.Read()) { List<string> attribs = new List<string>(); if (reader.HasAttributes) { for (int i = 0; i < reader.AttributeCount; i++) { attribs.Add(reader.GetAttribute(i).ToString()); } } if (reader.LocalName == "comment") { newComment.Text = reader.ReadString(); newComment.Date = attribs[0]; newComment.Id = attribs[1]; newComment.Up = attribs[3]; newComment.Down = attribs[4]; newComment.Replies = attribs[5]; newComment.User = attribs[6]; comments.Add(newComment); newComment = new Comment(); } } return comments; }
public bool Contains(Comment c) { return cContains(c); }
private bool cContains(Comment c) { return alComments.Contains(c) ? true : false; }
public void Add(Comment c) { alComments.Add(c); }