Skip to content

Instantly share code, notes, and snippets.

@jkotas
Created October 2, 2016 04:41
Show Gist options
  • Save jkotas/a2f4b64b19f04e786d25d37a796533aa to your computer and use it in GitHub Desktop.
Save jkotas/a2f4b64b19f04e786d25d37a796533aa to your computer and use it in GitHub Desktop.
Array.Resize
using System;
struct MyStruct<A,B>
{
public static void foo(int depth)
{
MyStruct<A,B>[] a = null;
Array.Resize(ref a, 1);
if (depth-- == 0) return;
MyStruct<MyStruct<A,B>,B>.foo(depth);
MyStruct<A,MyStruct<B,A>>.foo(depth);
}
}
class My
{
static void Main()
{
int start = Environment.TickCount;
MyStruct<int,uint>.foo(8);
int end = Environment.TickCount;
Console.WriteLine((end-start).ToString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment