Created
September 16, 2019 03:14
-
-
Save IntegerMan/3a03948e3e46fb4a8df451af6cca8c72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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