public static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); List <string> elements = new List <string>(); for (int i = 0; i < n; i++) { string currentelement = Console.ReadLine(); elements.Add(currentelement); } int[] indexes = Console.ReadLine().Split(" ").Select(int.Parse).ToArray(); int firstIndex = indexes[0]; int secondIndex = indexes[1]; Box <string> box = new Box <string>(elements); box.Swap(firstIndex, secondIndex); Console.Write(box.ToString()); }
static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); List <string> list = new List <string>(); for (int i = 0; i < n; i++) { list.Add(Console.ReadLine()); } Box <string> box = new Box <string>(list); int[] indexes = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); int firstIndex = indexes[0]; int secondIndex = indexes[1]; box.Swap(firstIndex, secondIndex); Console.WriteLine(box.ToString()); }
static void Main() { Box <string> box = new Box <string>(); int countItems = int.Parse(Console.ReadLine()); for (int i = 0; i < countItems; i++) { box.Add(Console.ReadLine()); } int[] inputIndexes = Console.ReadLine() .Split(' ', StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); int firstIndex = inputIndexes[0]; int secondIndex = inputIndexes[1]; box.Swap(firstIndex, secondIndex); Console.WriteLine(box.ToString()); }
static void Main(string[] args) { Box <string> box = new Box <string>(); int countLines = int.Parse(Console.ReadLine()); for (int i = 0; i < countLines; i++) { string input = Console.ReadLine(); box.Add(input); } int[] indexes = Console.ReadLine() .Split(" ", StringSplitOptions.RemoveEmptyEntries) .Select(int.Parse) .ToArray(); box.Swap(indexes[0], indexes[1]); string result = box.ToString(); Console.WriteLine(result); }