I have list of string and there are number of string in the list. Each string in the list start with number.
List<String> stringList=new List<String>();
stringList.Add("01Pramod");
stringList.Add("02Prakash");
stringList.Add("03Rakhi");
stringList.Add("04Test");
stringList.Add("04Test1");
stringList.Add("04Test2");
I want a Linq query that will return me list of string that starts with 04.
stringList.Where(s => s.StartsWith("04"))
or
stringList.Where(s => s.StartsWith("04")).ToList()
if you need a list
var result = stringList.Where(i => i.StartsWith("04"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With