Linq to objectテクニック、使い方集錦

1648 ワード

1、1つの文字列、1つの文字列配列.文字列配列の要素が文字列に現れるいくつかを判断します.
    class Program

    {

        static void Main(string[] args)

        {

            string str = "";

            string[] WordList = new string[] {" "," "," "," " };

            int count = WordList.Where(m => str.Contains(m)).Count();



            Console.WriteLine(count);   // 2



            Console.ReadKey();

        }

    }