How to match a column which has multiple integer values separated by commas in linq?
I have list, in which i have column with multiple integer values(separated by commas).
eg:
cannot convert string to int
Can any one plz help me.
Thanks
eg:
------------------------ | Program | Module | ------------------------ | I | 1,2,3 | ------------------------ | II | 2, 3 | ------------------------ | III | 1,3 | ------------------------Now, supppose, if i want to select programs where module is 2.
int sid = 2; IEnumerable<int> ids = Program.All.FindAll( item => sid.contains( item.Module.Split(',').Select(s => (int)s) ) ) getting compilation error:
cannot convert string to int
Can any one plz help me.
Thanks
Comments
.Select(s => int.Parse(s))