Extending List<T> and Violating The Open/Closed Principle
问题 I just created the following method in one of my classes public static bool Assimilate(this List<Card> first, List<Card> second) { // Trivial if (first.Count == 0 || second.Count == 0) { return false; } // Sort the lists, so I can do a binarySearch first.Sort(); second.Sort(); // Copia only the new elements int index; for (int i = 0; i < second.Count; i++) { index = first.BinarySearch(second[i]); if (index < 0) { first.Insert(~index, second[i]); } } // Edit second = null; return true; } And a