Created
June 1, 2015 21:00
-
-
Save ArildF/60e2998cb6c081cc1de9 to your computer and use it in GitHub Desktop.
WTF, dynamic?
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
using System; | |
namespace ConsoleApplication15 | |
{ | |
public class Args | |
{} | |
public class Class | |
{ | |
public void Execute(Args args) | |
{ | |
Console.WriteLine(args); | |
} | |
} | |
class Program | |
{ | |
static void Main() | |
{ | |
dynamic c = new Class(); | |
// doesn't work: | |
// object args = new Args(); | |
// works: | |
//dynamic args = new Args(); | |
// works | |
var args = new Args(); | |
c.Execute(args); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment