A very basic question, consider this methods:
public object Foo(object bar) {... }
vs
public dynamic Bar(dynamic bar) {... }
>
dynamic
in C# is translated to object
in IL.
.method private hidebysig instance object Foo(object bar) cil managed
{...}
.method private hidebysig instance object Bar(object bar) cil managed
{
.param [0]
.custom instance void [System.Core]System.Runtime.CompilerServices.DynamicAttribute::.ctor() = ( 01 00 00 00 )
.param [1]
.custom instance void [System.Core]System.Runtime.CompilerServices.DynamicAttribute::.ctor() = ( 01 00 00 00 )
...
}
The signature stays the same, only the Dynamic
attribute is added to the return and first parameter.
If you can change the parameter type from dynamic
to object
without having to change any other code, do it.