Skip to content

Instantly share code, notes, and snippets.

@vbfox
Created November 3, 2011 19:54
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 vbfox/1337604 to your computer and use it in GitHub Desktop.
Save vbfox/1337604 to your computer and use it in GitHub Desktop.
Abuse C# operators
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