I have an array of int containing some values starting from index 0. I want to swap two values for example value of index 0 should be swapped with the value of index 1. How
use a tuple
int[] arr = { 1, 2, 3 }; (arr[0], arr[1]) = (arr[1], arr[0]); Console.WriteLine(string.Format($"{arr[0]} {arr[1]} {arr[2]}")); // 2 1 3