Use Quantifiers: Any : Any « LINQ « C# / C Sharp






Use Quantifiers: Any

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {
        string[] words = { "bei", "rie", "rei", "field" };

        bool iAfterE = words.Any(w => w.Contains("ei"));

        Console.WriteLine("There is a word that contains in the list that contains 'ei': {0}", iAfterE);
    }
}

 








Related examples in the same category

1.Any operator with an string array
2.Any with condition
3.Any with string operator
4.Any with false predicate
5.Contains, Any return a bool value