我试图通过以下代码对列表进行分组
var b = groupBy(value[index],(ABC item) => item.id);
dropDownMenuItem = buildDropDownMenuItems(b.values);
b现在为Map<String, List<ABC>>
在buildDropDownMenuItems
中,我想通过List<ABC>
List<DropdownMenuItem<ABC>> buildDropDownMenuItems(List<ABC> asset) {
......
}
错误
不能将参数类型“ Iterable>”分配给 参数类型“列表”。
答案 0 :(得分:0)
在 searchParams.UseLast = Convert.ToBoolean(base.Arguments["UseLast"]);
searchParams.LastEditedFrom= Convert.ToDateTime(base.Arguments["LastEditedFrom"]);
searchParams.LastEditedTo = Convert.ToDateTime(base.Arguments["LastEditedTo"]);
searchParams.Reviewed = Convert.ToBoolean(base.Arguments["Reviewed"]);
searchParams.Approved = Convert.ToBoolean(base.Arguments["Approved"]);
searchParams.Include = Convert.ToBoolean(base.Arguments["Include"]);
searchParams.IsVisibleToUser = Convert.ToBoolean(base.Arguments["IsVisibleToUser"]);
searchParams.IsEntry = Convert.ToBoolean(base.Arguments["IsEntry"]);
searchParams.UserId = Convert.ToInt32(base.Arguments["UserId"]);
IEnumerable Categories = base.Arguments["Categories"] as IEnumerable;
IEnumerable Departments = base.Arguments["Departments"] as IEnumerable;
String mQuery = "How to construct it ....!!!" // Need help in this
var query = queryParser.Parse(mQuery);
indexSearcher.Search(query, collector);
上尝试expand
功能
values
但是很明显,它在var b = groupBy(value[index],(ABC item) => item.id);
dropDownMenuItem = buildDropDownMenuItems(b.values.expand((item) => item).toList());
函数之前为您提供了相同的未分组列表。可能您想将其用作group by
b["your key"]