Skip to content

Instantly share code, notes, and snippets.

@skoon
Created May 14, 2009 22:34
Show Gist options
  • Save skoon/111967 to your computer and use it in GitHub Desktop.
Save skoon/111967 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;
string firstFoo = dynFoo();
this.TakeSome = () => { return "MegaFoo"; };
dynamic secondDynFoo = this.TakeSome;
string secondFoo = dynFoo();
string thirdFoo = this.TakeSome();
string fourthFoo = secondDynFoo();
return dynFoo();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment