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
Post a Comment