29 Ağustos 2012 Çarşamba

using toString() without doing null check

Checking for null each time before calling toString() for an object is annoying, especially while logging..
Here is the solution: 

string.Format("{0}", myObj); 
displays an empty string for null object, otherwise calls toString()..

Hiç yorum yok:

Yorum Gönder