Certain methods such as ToString
and Dispose
are considered to be critical and are expected to work at all times. Throwing exceptions from such methods may interrupt the normal execution of your program. Consider returning an appropriate value instead.
public override string ToString()
{
if (/* some condition */)
throw new ArgumentException("Invalid `param`, could not generate `str`");
}
public override string ToString()
{
if (/* some condition */)
return string.Empty;
}