I get an array of strings that have property names. I only want to load these properties when retrieving data, in this case from the Entity Framework database. Sort of:
var result = db.myTable
.Where(x => x.Id == "someValue")
.Select(y => new {y.someProperty, y.someOtherproperty, ...});
How to create an anonymous object from an array of strings. I would like to have something like:
var MyObj = new {};
foreach(var I in MyStrinArr)
{
... Add the properties here ...
}
var result = db.myTable.Where(x => x.Id=="someValue").Select(y => obj);
source
share