i am using LINQ to entity to return a list of objects
var st = personsList.Select(p => new
{
ID = p.Id,
Key = p.Key,
Name = p.Name,
Address = p.Address,
City = p.City,
PhoneNumber = p.PhoneNumber
})
return st.ToList();
after i get the list in another class how can I access each property?
something like
foreach(object s in St)
{
string name = s.Name;
}
I have no predefined class to cast the object to it.
Can this be done without having to create a class and cast the object to that class type?
Thanks
You could use the follwing
you have to add the namespace System.Reflection to the class