[Solved] Average of empty list throws InvalidOperationException: Sequence contains no elements [closed]


Not much to it – it’s just how the code was written. Take a look at the docs and you’ll see –

Exceptions

ArgumentNullException – source is null.

InvalidOperationException – source contains no elements.

Makes sense though. You can’t get an average from zero items.

2

solved Average of empty list throws InvalidOperationException: Sequence contains no elements [closed]