Skip to content

Instantly share code, notes, and snippets.

@biac
Created June 11, 2012 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biac/2908926 to your computer and use it in GitHub Desktop.
Save biac/2908926 to your computer and use it in GitHub Desktop.
Kujian - 参加者.cs
public class 参加者
{
private const string OriginalData = @"…略(約40人分)…";
public string Name { get; set; }
public string ImageUrl { get; set; }
public static IList<参加者> Create()
{
XName img = XName.Get("img");
XName attr_alt = XName.Get("alt");
XName attr_src = XName.Get("src");
var xDoc = XDocument.Parse(OriginalData);
var list = xDoc.Descendants(img).Select((e) => new 参加者()
{
Name = e.Attribute(attr_alt).Value,
ImageUrl = e.Attribute(attr_src).Value,
}).ToList();
return list;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment