I've LINQ requests that return anonymous types like:
var result = context.Table1.Select(
x => new
{
col1 = x.col1,
col2 = x.col2
}).ToList();
That works fine, until I want to hand over the result to another function.
Than I need to specify exactly, what's type the list is. I cannot use var anymore.
But if I use
List< (string col1, string col2)> result ...
I get an "Cannot implicitly convert type ..." error.
Yes, I can create a new class for each entity. But is this the only way to handle it?
dynamiccan help you.