Created
November 3, 2011 19:54
-
-
Save vbfox/1337604 to your computer and use it in GitHub Desktop.
Abuse C# operators
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
struct T | |
{ | |
public static Action<string>[] operator + (T inst) | |
{ | |
return new Action<string>[] { i => Console.WriteLine(i) }; | |
} | |
} | |
void Main() | |
{ | |
(+new T())[0]("Hello world"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment