I am puzzled on how to get a specific info from an IEnumerable<object>
.
My application back end provides an IEnumerable<object>
which contains a collection of these two properties.
int id
string chronik
for GUI usage I want to select the string property only
I tried this:
//creating objects
backend be = new backend();
chronikDTO cronDTO = new chronikDTO();
be.getallchronik(cronDTO); //calling DB-query via Entityframework
string[] cronarry = new string[] {};
for (int x=0; x <= cronDTO.chronik.count(); x++)
{
cronarry[x] = cronDTO.chronik.select(y => y.cron.tostring());
}
but this doesn't lead to a usable result. I've not written a new method which queries only the string property from the database, in case in other use cases I need both properties.