Skip to content

Instantly share code, notes, and snippets.

@airbreather
Created January 10, 2014 08:02
Show Gist options
  • Save airbreather/8348404 to your computer and use it in GitHub Desktop.
Save airbreather/8348404 to your computer and use it in GitHub Desktop.
Closest I've got...
namespace Puzzle
{
// Using the tokens
// ? null :
// in that order, create a valid C# program such that
// the program is also valid when "null" is removed.
class Puzzle
{
enum E { V }
struct S
{
public static implicit operator E(S? k) { return E.V; }
public static implicit operator S?(E m) { return null; }
public static implicit operator bool(S? k) { return true; }
}
static void Main(string[] args)
{
const E m = E.V;
switch (m)
{
case m as S? null : m : break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment