Dynamic Linq Select -How to extract the results -


i have dynamic linq select statement of form

var projection = result.asqueryable().select(string.format("new({0},{1})",          model.xtabrow, model.xtabcolumn)); 

this works fine , produces iqueryable of anonymous types.

however unable convert ienumerable use linq on asenumerable method seems missing. had use reflection extract field values in end

there must better way - great

thanks

you can try this

var projection = result.asqueryable().select(string.format("new({0},{1})",      model.xtabrow, model.xtabcolumn));  var enumerableprojection = (from dynamic p in projection select p).asenumerable(); 

or

var projection = result.asqueryable().select(string.format("new({0},{1})",      model.xtabrow, model.xtabcolumn));  var enumerableprojection = projection.cast<dynamic>().asenumerable(); 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -