Match Item That Exists In A List Using Regular Expression And LINQ
Hi!
Using Any() in LINQ, we can match/find an item that exists in a List<T> or IEnumerable using Regular Expressions.
Where Products is the List object and ProductsFromFrance.FrenchProdPattern is the Regular Expression pattern.
Using Any() in LINQ, we can match/find an item that exists in a List<T> or IEnumerable using Regular Expressions.
if(Products.Any(t => Regex.IsMatch(t, ProductsFromFrance.FrenchProdPattern)) { //true statement here.. }
Comments
Post a Comment