.NET프로그래밍/C# 3.5 SP1

88. LINQ - 병합

holland14 2009. 8. 19. 17:03

using System;
using System.Linq;

public class 병합
{
    public static void Main()
    {
        int[] data1 = { 3, 5, 4 };
        int[] data2 = { 2, 1 };

        int[] result = (from o in data1 select o).Union(from t in data2 select t).OrderBy(x => x).ToArray();

        for (int i = 0; i < result.Length; i++)
        {
            Console.WriteLine("{0}", result[i]);
        }
    }
}