CODEKILLER

반응형

Linq - Union 출력.
Linq - Union 출력.

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

        string[] words1 = { "Mercury", "Venus", "Earth", "Jupiter" };
        string[] words2 = { "Mercury", "Earth", "Mars", "Jupiter" };

        IEnumerable<string> query = from unionexam in words1.Union(words2)
                                    select unionexam;

        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