Skip to content

Instantly share code, notes, and snippets.

@jkotas
Created February 18, 2017 14:03
Show Gist options
  • Save jkotas/07f1f77505611168c295993073633d71 to your computer and use it in GitHub Desktop.
Save jkotas/07f1f77505611168c295993073633d71 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
struct MyG<T,U> : IEquatable<MyG<T,U>>
{
static bool visited;
public static void foo(int depth)
{
if (visited) return;
visited = true;
EqualityComparer<MyG<T,U>>.Default.Equals(default(MyG<T,U>), default(MyG<T,U>));
if (depth-- == 0) return;
MyG<U,T>.foo(depth);
MyG<MyG<T,U>,T>.foo(depth);
MyG<MyG<T,U>,U>.foo(depth);
MyG<T,MyG<T,U>>.foo(depth);
MyG<U,MyG<T,U>>.foo(depth);
}
public bool Equals(MyG<T,U> other)
{
return true;
}
}
class My
{
static void Main()
{
int start = Environment.TickCount;
MyG<string,int>.foo(6);
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