Skip to content

Instantly share code, notes, and snippets.

@jzebedee
Created August 29, 2014 21:05
Show Gist options
  • Save jzebedee/dfc0907fb65c534143f1 to your computer and use it in GitHub Desktop.
Save jzebedee/dfc0907fb65c534143f1 to your computer and use it in GitHub Desktop.
plagiarized from a great book
a
----
static void Main(string[] args)
{
int a = 13;
int b = 14;
int c = a + b;
Console.WriteLine(c);
}
b
----
static void Main(string[] args)
{
dynamic a = 13;
dynamic b = 14;
dynamic c = a + b;
Console.WriteLine(c);
}
b in real C#
----
private static void Main(string[] args)
{
object a = 13;
object b = 14;
if (Program.<Main>o__SiteContainer0.<>p__Site1 == null)
{
Program.<Main>o__SiteContainer0.<>p__Site1 =
CallSite<Func<CallSite, object, object, object>>.
Create(Binder.BinaryOperation(CSharpBinderFlags.None,
ExpressionType.Add,
typeof(Program),
new CSharpArgumentInfo[]
{
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
}));
}
object c = Program.<Main>o__SiteContainer0.
<>p__Site1.Target(Program.<Main>o__SiteContainer0.<>p__Site1, a, b);
if (Program.<Main>o__SiteContainer0.<>p__Site2 == null)
{
Program.<Main>o__SiteContainer0.<>p__Site2 =
CallSite<Action<CallSite, Type, object>>.
Create(Binder.InvokeMember(CSharpBinderFlags.ResultDiscarded,
"WriteLine",
null,
typeof(Program),
new CSharpArgumentInfo[]
{
CSharpArgumentInfo.Create(
CSharpArgumentInfoFlags.UseCompileTimeType |
CSharpArgumentInfoFlags.IsStaticType,
null),
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
}));
}
Program.<Main>o__SiteContainer0.<>p__Site2.Target(
Program.<Main>o__SiteContainer0.<>p__Site2, typeof(Console), c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment