Skip to content

Instantly share code, notes, and snippets.

@MartinZikmund
Created April 3, 2019 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinZikmund/beed798a2c2e43f719b0774fa87cc792 to your computer and use it in GitHub Desktop.
Save MartinZikmund/beed798a2c2e43f719b0774fa87cc792 to your computer and use it in GitHub Desktop.
private string SafeGetValue<T>(Func<T> getter)
{
try
{
var value = getter();
if ( value == null)
{
return "(null)";
}
return Convert.ToString(value);
}
catch (NotImplementedException ex)
{
return "(Not implemented)";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment