This is explained in here :
Overload resolution occurs at run time, and not at compile time, if one or more of the arguments in the method call is of dynamic type or if the receiver of the method call is of type dynamic.
Now in the case of F(a) , since a is dynamic, the compiler does not check overloads at compile time. But when you say:
F(2);
2 is an integer, not dynamic . That is why overload resolution occurs at compile time, and you get an error. If you pass an integer literal to dynamic, you will not get any error at compile time (but you do this at runtime):
int x = F((dynamic)2);
source share