C#
14.C# -알고리즘 : LINQ 병합 (LINQ - MEARGE)
Godffs
2009. 8. 20. 00:14
반응형
C# LINQ를 이용한 배열 병합 예제입니다.
결과화면
Program.cs |
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]); } } } |
반응형