Here\'s the scenario...
if (entry.Properties[\"something\"].Value != null)
attribs.something = entry.Properties[\"something\"].Value.ToString();
<
Is it somehow possible to do something like Dale Ragan's answer above, but overriding ToString() instead of creating a new NullSafeToString() method? I'd like this (or returning "null") to be the default behaviour. The compiler (Visual C# 2010 Express) doesn't complain when I add the following method to public static class ObjectExtensions, but the method doesn't get called...
public static String ToString(this Object obj)
{
if (obj == null)
{
return "null";
}
else
{
return obj.GetType().Name;
}
}