c# - Searching on an array of integers -
i've got string coming in so:
'202,203,204,205,226,230,274'
i want break string down array of numbers , records ids.
so far, have:
string[] myarray = mystring.split(','); int[] myintarray = new int[myarray.length]; for(int x = 0; x < myarray.length; x++) { myintarray[x] = convert.toint32(myarray[x].tostring()); } model.records = db.records .where(q => q.recordid.contains(myintarray) .tolist();
it's complaining contains not working ints. confused contains does?
thanks in advance!
i think want do:
.where(q => myintarray.contains(q.recorid))
the way have it, you're expecting recordid
array (i'm assuming it's int
?), whereas think want take single recordid
, see if it in array of int
s.
Comments
Post a Comment