Skip to content

Instantly share code, notes, and snippets.

@slpsys
Created April 9, 2013 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slpsys/5349553 to your computer and use it in GitHub Desktop.
Save slpsys/5349553 to your computer and use it in GitHub Desktop.
Bending the language to my will in the name of science, with presumably horrific consequences.
using System;
using var = TestBed.MyClass;
namespace TestBed
{
public class MyClass
{
public static implicit operator MyClass(int me)
{
return null;
}
public static implicit operator MyClass(string me)
{
return null;
}
}
public class VarTest
{
public static void Main()
{
var x = 10;
x = "hello";
Console.WriteLine(x == null);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment