Skip to content

Instantly share code, notes, and snippets.

@flibitijibibo
Last active August 29, 2015 14:00
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 flibitijibibo/f6339ec27c5b660ce40e to your computer and use it in GitHub Desktop.
Save flibitijibibo/f6339ec27c5b660ce40e to your computer and use it in GitHub Desktop.
public class SomeThang
{
int whoCares;
public SomeThang(int whatever)
{
whoCares = whatever;
}
static public implicit operator bool(SomeThang someThang)
{
return someThang != null;
}
public static void Main(string[] args)
{
SomeThang a = new SomeThang(69);
SomeThang b = new SomeThang(1337);
System.Console.WriteLine(a.GetHashCode() != b.GetHashCode()); // true
System.Console.WriteLine(a != b); // true in .NET, false in Mono!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment