c# - Retrieve comma-separated values from IQueryable and add to list -


iqueryable<string> scannedbarcodes = xyzdb.tblscannedbarcodes                                           .where(i => i.pullno == lblpullno.text)                                           .select(i => i.barcode); 

the result view shows

"678765,090909,243454,675434" 

now want add comma-separated values list.

rest of code below:

foreach (var item in scannedbarcodes) {     list<string> _barcodes = new list<string>();     _barcodes.add(item); } 

how split it?

thanks in advance

the splitting can done using linq follows.

var _barcodes =     scannedbarcodes.selectmany(istring => istring.split(new char[]{ ','}))                    .tolist(); 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -