我有一个父列表如下。
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};
当我尝试执行以下操作时,虽然它应该返回 true,但它返回 false。我在这里做错了吗?
parentList.Contains(listToFind);
任何建议将不胜感激。
谢谢,
扬凯格