vendredi 9 mars 2018

How can I convert reflection method result to array?

I'm using reflection with parameter. I'm getting results as IQueryable. I want to convert this ToArray(). I tried Array instead of IQueryable but not working like following code:

var countries = entity.Countries.ToArray(); 

How can i get same result with this code?

public IQueryable Get(string tableName)
{
    var result = _db.GetType().GetProperty(tableName)?.GetValue(_db, null) as IQueryable;
    return result;
}





Aucun commentaire:

Enregistrer un commentaire