【发布时间】:2016-08-29 06:46:24
【问题描述】:
我有一个类,我们将其命名为 MyClass,具有 IList<AnotherType> 类型的公共字段:
class MyClass
{
public IList<AnotherType> MyListProperty {get;}
}
我的应用中还有一个 MyClass 对象列表:
list = new List<MyClass>();
我想从这个“列表”中获取一个组,特别是
IOrderedEnumerable<IGrouping<MyClass,AnotherType>> 使用 Linq,它将用作 CollectionViewSource 的源,并将作为分组的 ListView 显示给用户。我该怎么做?
换句话说,我想将“列表”合并到一个分组的可枚举中,其中键为MyClass 实例,值为MyClass.MyListProperty。
【问题讨论】:
-
尝试用一个例子编辑,现在有点混乱。
标签: c# linq collectionviewsource