Accessing C# Anonymous Type Objects
- by Ali Kazmi
Hi,
How do i access objects of an anonymous type outside the scope where its declared?
for e.g.
void FuncB()
{
var obj = FuncA();
Console.WriteLine(obj.Name);
}
??? FuncA()
{
var a = (from e in DB.Entities
where e.Id == 1
select new {Id = e.Id, Name = e.Name}).FirstOrDefault();
return a;
}