Created
October 2, 2016 04:41
-
-
Save jkotas/a2f4b64b19f04e786d25d37a796533aa to your computer and use it in GitHub Desktop.
Array.Resize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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