【发布时间】:2013-09-10 08:40:16
【问题描述】:
我有一个如下的父列表。
IList<List<int>> parentList = new List<List<int>>();
parentList.Add(new List<int> { 0, 1, 2 });
parentList.Add(new List<int> { 3, 4, 5 });
parentList.Add(new List<int> { 6, 7, 8 });
parentList.Add(new List<int> { 0, 4, 8 });
parentList.Add(new List<int> { 2, 4, 6 });
parentList.Add(new List<int> { 0, 3, 6 });
parentList.Add(new List<int> { 1, 4, 7 });
parentList.Add(new List<int> { 2, 5, 8 });
作为我程序的一部分,我正在生成一个列表
List<int> listToFind = new List<int>{1, 4, 7};
当我尝试执行以下操作时,它返回 false,尽管它应该返回 true。我在这里做错了吗?
parentList.Contains(listToFind);
任何建议将不胜感激。
谢谢,
詹卡吉格
【问题讨论】:
标签: list c#-4.0 generics contains generic-list