我能在函数中使用匿名类型作为返回类型,然后将返回的值添加到数组或某种集合中,并同时向新数组/集合添加一个额外的字段吗?请原谅我的伪代码...
private var GetRowGroups(string columnName)
{
var groupQuery = from table in _dataSetDataTable.AsEnumerable()
group table by new { column1 = table[columnName] }
into groupedTable
select new
{
groupName = groupedTable.Key.column1,
rowSpan = groupedTable.Count()
};
return groupQuery;
}
private void CreateListofRowGroups()
{
var RowGroupList = new List<????>();
RowGroupList.Add(GetRowGroups("col1"));
RowGroupList.Add(GetRowGroups("col2"));
RowGroupList.Add(GetRowGroups("col3"));
}