c# - How can I cast a collection -


this code:

ilist<string> quids; quids = db.database.sqlquery<string>("dbo.getbyid @id",                 new sqlparameter { parametername = "id", value = 1 }); 

produces following error message:

cannot implicitly convert type 'system.data.entity.infrastructure.dbrawsqlquery' 'system.collections.generic.ilist'.

an explicit conversion exists (are missing cast?)

can explain me how can cast collection?

ilist<string> result = oldcollection.tolist(); 

dbrawsqlquery<t> not implement ilist<t> interface (so, no direct cast possible). implements ienumerable<t>, can call .tolist().


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -