If we pass to AverageYearsWorkedAtTheCompany an empty list or a list that contains only employees that still employed, method Average() will throw an exception, as it requires at least one element (
|
static double AverageYearsWorkedAtTheCompany(List<Employee> employees) |
).
I've solved it like this:
https://github.com/emanuelefirmani/FunctionalProgrammingCSharp/blob/master/FunctorsMonads/WorkPermitCode.cs#L20
If we pass to AverageYearsWorkedAtTheCompany an empty list or a list that contains only employees that still employed, method Average() will throw an exception, as it requires at least one element (
functional-csharp-code/Exercises/Chapter04/Solutions.cs
Line 67 in e151c28
I've solved it like this: https://github.com/emanuelefirmani/FunctionalProgrammingCSharp/blob/master/FunctorsMonads/WorkPermitCode.cs#L20