public static void CopyFrom <T1, T2>(this DualHashSet <T1, T2> destination, DualHashSet <T1, T2> source) { destination.HashSet1.Clear(); destination.HashSet2.Clear(); // Add elements of T1 type... foreach (var entry in source.HashSet1) { destination.Add(entry); } // Add elements of T2 type... foreach (var entry in source.HashSet2) { destination.Add(entry); } }