Get specific items from Generic List collection based on condition using C#

Last Reply on Oct 10, 2017 04:39 AM By susanta

Posted on Oct 10, 2017 12:57 AM

i have a list of value i have to grouping it,

i have to grouping it by the values present in the list, the first letter should be C and other are in between 000-199

Ex: C002

C101

C199

C123

like this

i have values a list that contain

D500

C020

C199

C321

i have to collect all the Value start with C and Number in Between 000-199

C001

C003

it will store to one list

how can i do this?

You are viewing reply posted by: susanta on Oct 10, 2017 04:39 AM.
Posted on Oct 10, 2017 04:39 AM
var Taglist = from r in mTagsList.AsEnumerable() where Regex.IsMatch(r, "^[C]+([0-1]{1}[0-9]{1,2})$") select r;

Regular expression @"^[C]+([0-1]{1}[0-9]{1,2})$"