Deferred Overload Resolution
In the preceding example, things are getting more interesting at runtime. As you will see later, a call site object is hiding behind the compiled code for the
Math.Max call. Now it’s totally possible this code path gets hit multiple times, with different runtime types for
a. One time,
a may happen to be an
Math.Max really has two
Int32 inputs. The runtime magic of
dynamic figures out the best overload is
Math.Max(int, int) and causes the call to be dispatched to that target method.
When another trip through the code is made with the runtime type of
a being an
Int64, the call site is now faced with an
Int32 and an
Int64. Again, in concert with the runtime binder, it figures out the best overload for the call ...