标签:style blog color div ar new c# log
判断List相等
List<string> list1 = new List<String>() { "1", "2", "3", }; List<string> list2 = new List<String>() { "1", "2", "3", }; bool compare1 = list1 == list2; bool compare2 = list1.Equals(list2); bool compare3 = list1.SequenceEqual(list2);
注意: 用==, Equals对对象判断的时候,由于对象的引用地址不同,上述中的compare1, compare2 都返回为 false. 只有 compare3 是 true;
标签:style blog color div ar new c# log
原文地址:http://www.cnblogs.com/fdyang/p/3871659.html