English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

LINQ 연결 연산자 Concat

Concat() 메서드는 두 개의 동일한 타입의 시퀀스를 추가하여 새로운 시퀀스(집합)를 반환합니다.

IList<string> collection1 = new List<string>() { "One", "Two", "Three" };
IList<string> collection2 = new List<string>() { "Five", "Six"};
var collection3 = collection1.Concat(collection2);
foreach (string str in collection3)
    Console.WriteLine(str);
출력:
One
Two
Three
Five
Six
IList<int> collection1 = new List<int>() { 1, 2, 3 };
IList<int> collection2 = new List<int>() { 4, 5, 6 };
var collection3 = collection1.Concat(collection2);
foreach (int i in collection3)
    Console.WriteLine(i);
출력:

1
2
3
4
5
6

C# 또는 VB.Net에서의 쿼리 문법은 Concat 연산자를 지원하지 않습니다.