DEV Community

Discussion on: What are the differences between Convert.ToString() and .ToString() method?

Collapse
 
sirseanofloxley profile image
Sean Allin Newell

Convert.ToString certainly handles null elegantly, but we can control null coalescence with the instance method too.

aStr?.ToString() ?? "";
Collapse
 
thedotnetweekly profile image
The DotNET Weekly • Edited

That is true Sean.Unfortunately, the most common mistake I have seen people do is even after being aware of this and forget to put it until an exception is thrown on production :)