|
|
От: | -n1l- | |
| Дата: | 26.05.12 17:30 | ||
| Оценка: | |||
_>using System;
_>using System.Collections.Generic;
_>using System.Linq;
_>using System.Text;
_>using System.Threading.Tasks;
_>namespace ConsoleApplication2
_>{
_> class Program
_> {
_> static void Main(string[] args)
_> {
_> string[] array1 = {
_> "кириешки", "кириешки", "кириешки", "кириешки", "кириешки", "кириешки", "кириешки", "кириешки",
_> "партия1", "партия1", "партия1", "партия1", "партия1", "партия2", "партия2", "партия2",
_> };
_> int tableLength = array1.Length / 2;
_> var column1 = array1.Take(tableLength);
_> var column2 = array1.Skip(tableLength).Take(tableLength);
_> var result = column1.Zip(column2, (c1, c2) => new { Column1 = c1, Column2 = c2 });
_> foreach (var item in result.Distinct())
_> {
_> Console.WriteLine("{0} | {1}", item.Column1, item.Column2);
_> }
_> }
_> }
_>}
_>_>кириешки | партия1
_>кириешки | партия2
_>Для продолжения нажмите любую клавишу . . .
var column2 = array1.Skip(tableLength).Take(tableLength);
_> var result = column1.Zip(column2, (c1, c2) => new { Column1 = c1, Column2 = c2 });