I use LINQ for an 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?
sort of
foreach(object s in St)
{
string name = s.Name;
}
I do not have a predefined class to cast an object to it.
Is it possible to do this without creating a class and casting the object to the type of this class?
thank
source
share