Created
January 10, 2014 08:02
-
-
Save airbreather/8348404 to your computer and use it in GitHub Desktop.
Closest I've got...
This file contains hidden or 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
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