Use Quantifiers: Any : Any « LINQ « C# / CSharp Tutorial






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);
    }
}








22.18.Any
22.18.1.Any operator with an string array
22.18.2.Any with condition
22.18.3.Use Quantifiers: Any
22.18.4.Any with string operator
22.18.5.Any with false predicate
22.18.6.Contains, Any return a bool value
22.18.7.Any method