Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
class Program
{
static void Swap<T>(ref T a, ref T b)
{
T temp = a;
a = b;
b = temp;
}
static void Main()
{
int x = 10, y = 20;
Swap(ref x, ref y);
Console.WriteLine($"x = {x}, y = {y}");
string s1 = "Hello", s2 = "World";
Swap(ref s1, ref s2);
Console.WriteLine($"s1 = {s1}, s2 = {s2}");
}
}Coding works best on desktop or with an external keyboard.