How do I determine what methods are being implemented by another method?

I’m learning C# (VS 2019) after 20 years of coding ANSI-C. Let’s say some of the basics are still fuzzy.

In the book I’m using, the author introduced the override concept by overriding the virtual Object.ToString() method inside a user-generated class when implementing a call to Console.Writeline() when running the Main() program. That is, in the user class there is a public override string ToString() method which basically adds an overload to the .NET implementation. I get how all that works.

What I can’t find, is a way to determine that Console.Writeline() used the .ToString() method to do the work.

Is there a way to inspect .NET method code in some given class to find out if there are virtual methods being used I can exploit with an override in my own code? That is, how did the author know the .ToString() method was being used by ConsoleWriteline()?

Go to Source
Author: scottrod