So iam new to c# and trying to making a bubble sort algorithm and was wondering is there a way to swap 2 values in a list in the simplest way?
static void BubbleSort(List<int> list)
{
for (int i = 0; i == list.Count-1; i++)
{
for (int j = 0; i == list.Count - i; j++)
{
if (list[j] > list[j+1])
{
//Need a way to swap values in position j and j+1
}
}
}