Why would the compiler do this? He can not.
If you pass an object (in this case, in an int box), the only option for the compiler is to call string.Concat(object, object) . It cannot call string.Concat(string, string) , since both parameters are not string and therefore correspond to the second overload.
Instead, it calls string.Concat(object, object) and makes a ToString inside, if applicable.
You, as a developer, know how the string.Concat method string.Concat . The compiler does not know that eventually everything will become string .
Also, what happens if one of the object is null ? ToString will fail. It does not make sense. Just go to object and let the code handle it.
Patrick hofman
source share