Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created September 16, 2019 03:14
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 IntegerMan/3a03948e3e46fb4a8df451af6cca8c72 to your computer and use it in GitHub Desktop.
Save IntegerMan/3a03948e3e46fb4a8df451af6cca8c72 to your computer and use it in GitHub Desktop.
private decimal EvaluateEducation(
bool hasAppropriateDegree,
string degreeName,
Func<decimal> calculateFunc)
{
if (hasAppropriateDegree)
{
try
{
// Invoke the function provided and return its result
return calculateFunc();
}
catch (InvalidOperationException ex)
{
Console.WriteLine($"Could not calculate {degreeName} score: {ex.Message}");
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment