Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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