Visual Basic hides virtual methods from C#? Not really!

I was recently asked to investigate a potential issue about the C# to Visual Basic language inter-op. The punch line was that C# could not call a method defined in a library written in Visual Basic. However, if you used C# or Visual Basic for both assemblies, everything worked as expected. The Visual Basic code used to produce…

1

Using the static type of a variable in a dynamic call

As I said before, figuring out when the compiler will dispatch a call dynamically is simple: anytime the receiver or one of the arguments of a call is dynamic. And when using a variable of type dynamic means that the Runtime Binder will use the runtime type of the value stored in that variable and…

0

When does the compiler dispatch a call dynamically?

There are 2 cases when a call will be dispatched dynamically: When the receiver of the call is statically typed as dynamic 1: dynamic d = new MyClass(); 2: d.Foo(); When any of the arguments to the call are statically typed as dynamic 1: var o = new MyClass(); 2: dynamic d = 4; 3:…

0