Skip to content

Instantly share code, notes, and snippets.

@skoon
Created May 14, 2009 22:17
Show Gist options
  • Save skoon/111961 to your computer and use it in GitHub Desktop.
Save skoon/111961 to your computer and use it in GitHub Desktop.
class TestClass : ConsoleApplication1.ITestClass
{
//dynamic fooLambda = () => { return "foo"};
//dynamic fooAnonDelegate = delegate() { return "foo" };
//Those don't work "Cannot convert lambda to 'dynamic' because it
//is not a delegate type
public TakeSomeFoo TakeSome = () =>{ return "foo"; };
public delegate string TakeSomeFoo();
public string fooBar { get; set; }
public string foo()
{
dynamic dynFoo = this.TakeSome;
this.TakeSome = () => { return "MegaFoo"; };
return dynFoo();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment