Skip to content

Instantly share code, notes, and snippets.

@dirvo
Last active February 7, 2018 15:30
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 dirvo/bd2aa2242da0fd092239e8b117e9f1cb to your computer and use it in GitHub Desktop.
Save dirvo/bd2aa2242da0fd092239e8b117e9f1cb to your computer and use it in GitHub Desktop.
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