¿Puedo usar un tipo anónimo como tipo de retorno en una Función y luego agregar ese valor devuelto en una matriz o colección al mismo tiempo que agrego un campo adicional a la nueva matriz/colección? disculpen mi pseudocódigo ...Devolver Tipo anónimo desde una función
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"));
}
posible duplicado de [Acceso a C# Anónimo Tipo objetos] (http://stackoverflow.com/questions/713521/accessing-c-sharp -anonymous-type-objects) – nawfal
posible duplicado de [¿Devolver el tipo anónimo?] (http://stackoverflow.com/questions/534690/return-anonymous-type) –