List Contains - C#
Формулировка задачи:
Подскажите, что не так?
У меня b всегда false???
List<int[]> c = new List<int[]>();
c.Add(new int[2] { 1, 2 });
c.Add(new int[2] { 3, 4 });
bool b = c.Contains(new int[2] { 1, 2 });Решение задачи: «List Contains»
textual
Листинг программы
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication22 {
class Program {
static void Main(string[] args) {
int[] arrA = { 1, 2, 3 };
int[] arrB = { 2, 3, 4 };
List<int[]> list = new List<int[]>() { arrA, arrB };
int[] arrC = arrB;
Console.WriteLine(list.Contains(arrC));
int[] arrD = { 2, 3, 4 };
Console.WriteLine(list.Contains(arrD));
Console.ReadLine();
}
}
}