0
我想通過WCF服務填充longlist。彙編沒有錯誤,但執行的程序的結果看起來像這樣的三行:PhoneApp1.ServiceReference1.worker
而不是我想要顯示的名稱和其他數據。我的服務實施是:Longlist沒有正確創建
public IEnumerable<worker> GetStuffList()
{
List<worker> stuffList = new List<worker>();
stuffList.Add(new worker("John", 23, true));
stuffList.Add(new worker("Nick", 22, true));
stuffList.Add(new worker("Gill", 23, false));
return stuffList;
}
private List<Group<worker>> GetStuffEnumerable()
{
IEnumerable<worker> stuffList = GetStuffList();
return GetItemGroups(stuffList, c => c.Age.ToString());
}
private static List<Group<T>> GetItemGroups<T>(IEnumerable<T> itemList, Func<T, string> getKeyFunc)
{
IEnumerable<Group<T>> groupList = from item in itemList
group item by getKeyFunc(item) into g
orderby g.Key
select new Group<T>(g.Key, g);
return groupList.ToList();
}
public class Group<T> : List<T>
{
public Group(string name, IEnumerable<T> items)
: base(items)
{
this.Title = name;
}
public string Title
{
get;
set;
}
}