CODEKILLER

반응형

Linq - Intersect 예제
Linq - Intersect 예제

using System.Linq;
using System.Xml.Linq;

public class Example
{
    public static void Main()
    {
        Console.Write("<< Linq - Intersect 예제 >> \n");

        string[] words = { "this", "code", "killer", "killer", "code", "funny" };
        string[] words2 = { "this", "AA", "killer", "BB", "code", "CC" };

        IEnumerable<string> query = from code in words.Intersect(words2)
                                    select code;

        foreach (var str in query)
        {
            Console.WriteLine(str);
        }

        Console.WriteLine(System.Environment.NewLine);
        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
}
반응형

공유하기

facebook twitter kakaoTalk kakaostory naver band