首先创建枚举
public enum TheType { type1 = 1, type2 = 2, type3 = 3 }
1、如果不考虑顺序,即顺序不一样,只要元素都一样即可
List<TheType> t1 = new List<TheType>() { TheType.type1, TheType.type2 };
List<TheType> t2 = new List<TheType>() { TheType.type2, TheType.type1 };
var isEqual= Enumerable.SequenceEqual(t1.OrderBy(t => t), t2.OrderBy(t => t));
2、考虑顺序:
var a = ints1.SequenceEqual(ints2);