Accessing C# Anonymous Type Objects
Posted
by Ali Kazmi
on Stack Overflow
See other posts from Stack Overflow
or by Ali Kazmi
Published on 2009-04-03T11:13:23Z
Indexed on
2010/03/24
16:23 UTC
Read the original article
Hit count: 548
c#
|anonymous-types
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;
}
© Stack Overflow or respective owner