2015-10-10から1日間の記事一覧
値を Swap するメソッドです。 using System; class Program { static void Swap<T>(ref T a, ref T b) { var t = a; a = b; b = t; } static void Main() { int a = 1; int b = 2; Console.WriteLine($"{a} {b}"); Swap(ref a, ref b); Console.WriteLine($"{a</t>…