Lets say I have an method which returns an object. I return a new object which contains two properties Sum and Count. When I call this method, How can I retrieve these properties?
public static object SomeMethod(){
using (var context = new MappedTableEntities()){
return from x in context.SomeMappedTable
group x by 1 into g
select new
{
Count = g.Count(),
Sum = g.Sum(col => col.someSummableColumn)
};
}
}
when I call this function:
var obj = SomeClass.someMethod();
I do not see the properties exposed and I get a compiler error when I try to retrieve them. How can I expose these members?
/*ERROR */
var count = obj.Count;
var sum = obj.Sum;