/CrazyType.cs Secret
Last active
February 7, 2018 15:30
Star
You must be signed in to star a gist
This file contains 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; | |
class CrazyType | |
{ | |
private int _value; | |
public static implicit operator CrazyType(int value) | |
{ | |
return new CrazyType { _value = value }; | |
} | |
public static implicit operator int(CrazyType value) | |
{ | |
return value._value++; | |
} | |
private static void Main(string[] args) | |
{ | |
CrazyType a = 1; | |
if (a == 1 && a == 2 && a == 3) | |
{ | |
Console.WriteLine("YAY!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment