Sumeet Singh Sumeet Singh - 1 year ago 120
C# Question

Why explicitly call ToString() method in

I gather that
method accepts string argument and therefore we require
method to call on the argument.

object k = 999;

But when it comes to
, it is smart enough to do this by itself. My question is Why the difference?

Answer Source

If you have a look at,8c83114cc3fd109d

then you'll see that there are many overloads of the WriteLine function in the Console class, including Console.WriteLine(Object value). This is very convenient.

MessageBox.Show lacks these different overloads and excepts "only" a string.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download