■ Concat 확장 메소드를 사용해 데이터 결합하기
------------------------------------------------------------------------------------------------------------------------
▶ Program.cs
using System; using System.Collections.Generic; using System.Linq;
namespace TestProject { /// <summary> /// 프로그램 /// </summary> class Program { //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Static //////////////////////////////////////////////////////////////////////////////// Private
#region 프로그램 시작하기 - Main()
/// <summary> /// 프로그램 시작하기 /// </summary> private static void Main() { int[] integerArray1 = { 1, 2, 3, 4, 5, 6 };
Console.WriteLine("정수 배열 1");
foreach(int i in integerArray1) { Console.Write(".." + i); }
Console.WriteLine(); Console.WriteLine();
int[] integerArray2 = { 3, 4, 5, 6, 7, 8 };
Console.WriteLine("정수 배열 2");
foreach(int i in integerArray2) { Console.Write(".." + i); }
Console.WriteLine(); Console.WriteLine();
IEnumerable<int> resultEnmuerable = integerArray1.Concat(integerArray2);
Console.WriteLine("정수 배열 1 + 정수 배열 2");
foreach(int i in resultEnmuerable) { Console.Write(".." + i); }
Console.WriteLine(); Console.WriteLine(); }
#endregion } }
|
------------------------------------------------------------------------------------------------------------------------
'C# > Common' 카테고리의 다른 글
[C#/COMMON] FirstOrDefault 확장 메소드 사용하기 (0) | 2019.11.22 |
---|---|
[C#/COMMON] First 확장 메소드 사용하기 (0) | 2019.11.22 |
[C#/COMMON] Cast 확장 메소드를 사용하기 (0) | 2019.11.22 |
[C#/COMMON] OfType 확장 메소드를 사용해 특정 타입 요소 구하기 (0) | 2019.11.22 |
[C#/COMMON] Union 확장 메소드를 사용해 데이터 합집합 구하기 (0) | 2019.11.22 |
[C#/COMMON] Concat 확장 메소드를 사용해 데이터 결합하기 (0) | 2019.11.21 |
[C#/COMMON] Except 확장 메소드를 사용해 데이터 차집합 구하기 (0) | 2019.11.21 |
[C#/COMMON] Intersect 확장 메소드를 사용해 데이터 교집합 구하기 (0) | 2019.11.21 |
[C#/COMMON] group ... by 키워드 질의 형식을 사용해 그룹 목록 구하기 (0) | 2019.11.21 |
[C#/COMMON] GroupBy 확장 메소드를 사용해 그룹 목록 구하기 (0) | 2019.11.21 |
[C#/COMMON] OrderBy 확장 메소드 : IComparer<T> 인터페이스를 사용해 정렬하기 (0) | 2019.11.21 |
댓글을 달아 주세요