.NET Reflector Support: How can I tell which overload of a method is being called in the decompiled source code?

Many methods in .NET code are overloaded. For example, the PipeStream method on the StreamPiper class, in figure 1, has four overloads.

PipeStreamOverloads_thumb.png

Figure 1. The .NET Reflector browser, showing overloads of the PipeStream method on the StreamPiper class.

So, when you find one of these methods used in the decompiled source code, how do you know which overload is being called, other than by guessing, perhaps by looking at the number of parameters passed to the method?

Fortunately, this is fairly straightforward: just hover your mouse cursor over the method invocation, and .NET Reflector will pop up a tooltip telling you which overload is being called, as shown in figure 2, below.

OverloadTooltip_thumb.png

Figure 2. Decompiled source in the Disassembler pane with a tooltip showing which overload of the PipeStream method is being called. This example shows C#, however this also works for other languages.

Occasionally people ask us if we can further annotate invocations to overloaded methods, however there are a couple of problems with this. The first is that, unless we annotated with comments, there would be no chance of the code compiling, which would be a problem if you were trying to recover it. The second follows on from the first: any annotations would seriously interfere with the readability of the generated source code, simply because of the number of overloaded methods in most .NET code.