Skip to content

Error thrown for list of working employees #5

@emanuelefirmani

Description

@emanuelefirmani

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions