2
您可以共同編寫通用列表的交換例程嗎?這裏是一個交換程序將無法正常工作:共同交換列表中的兩個元素
public static void Swap(List<IComparable> list, int pos1, int pos2)
{
IComparable temp = list[pos1];
list[pos1] = list[pos2];
list[pos2] = temp;
}
打電話,是因爲這個版本的互換是不是協變Swap(new List<int>{1,2}, 0, 1)
不會在這裏工作。
如果添加一些示例代碼,即使是僞代碼,理解你在說什麼也會容易得多。 –
牆上的文字和沒有代碼。我懶得看完所有的東西。 –
@HighCore並非每一個編程問題都是關於代碼的。習慣它。 – poke