Skip to content

Instantly share code, notes, and snippets.

@ArildF
Created June 1, 2015 21:00
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 ArildF/60e2998cb6c081cc1de9 to your computer and use it in GitHub Desktop.
Save ArildF/60e2998cb6c081cc1de9 to your computer and use it in GitHub Desktop.
WTF, dynamic?
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