private static void Main() { array <@string> a = new array <@string>(2); a[0] = "Hello"; a[1] = "World"; test(a.Clone()); Console.WriteLine("{0}, {1}", a[0], a[1]); Console.WriteLine(); a[0] = "Hello"; test2(ref a); Console.WriteLine("{0}, {1}", a[0], a[1]); Console.WriteLine(); a[0] = "Hello"; test3(a.slice()); Console.WriteLine("{0}, {1}", a[0], a[1]); Console.WriteLine(); int[] primes = { 2, 3, 5, 7, 11, 13 }; Console.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}", primes.Cast <object>().ToArray()); Console.ReadLine(); }
// taken from cmd/go/internal/work/buildid.go private static @string hashToString(array <byte> h) { h = h.Clone(); const @string b64 = (@string)"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; const long chunks = (long)5L; array <byte> dst = new array <byte>(chunks * 4L); for (long i = 0L; i < chunks; i++) { var v = uint32(h[3L * i]) << (int)(16L) | uint32(h[3L * i + 1L]) << (int)(8L) | uint32(h[3L * i + 2L]); dst[4L * i + 0L] = b64[(v >> (int)(18L)) & 0x3FUL]; dst[4L * i + 1L] = b64[(v >> (int)(12L)) & 0x3FUL]; dst[4L * i + 2L] = b64[(v >> (int)(6L)) & 0x3FUL]; dst[4L * i + 3L] = b64[v & 0x3FUL]; } return(string(dst[..]));