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

عنصر الت串联 Concat في LINQ

يضيف طريقة 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.