Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
6
Task/Generic-swap/C-sharp/generic-swap-1.cs
Normal file
6
Task/Generic-swap/C-sharp/generic-swap-1.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
static void Swap<T>(ref T a, ref T b)
|
||||
{
|
||||
T temp = a;
|
||||
a = b;
|
||||
b = temp;
|
||||
}
|
||||
3
Task/Generic-swap/C-sharp/generic-swap-2.cs
Normal file
3
Task/Generic-swap/C-sharp/generic-swap-2.cs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int a = 1;
|
||||
int b = 2;
|
||||
Swap(ref a, ref b); // Type parameter is inferred.
|
||||
3
Task/Generic-swap/C-sharp/generic-swap-3.cs
Normal file
3
Task/Generic-swap/C-sharp/generic-swap-3.cs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int a = 1;
|
||||
int b = 2;
|
||||
(a, b) = (b, a);
|
||||
Loading…
Add table
Add a link
Reference in a new issue