ReSharper was giving me a CoVariantConversion warning so I decided to google this and see how to fix it. I came accross this snippet of code:
// ReSharper disable CoVariantArrayConversion
try
{
Task.WaitAll(taskList.ToArray());
}
catch (AggregateException ex)
{
ex.Handle(e => true);
}
// ReSharper restore CoVariantArrayConversion
This part is confusing me:
ex.Handle(e => true);
What does it do? I would think that it does nothing.
You are correct: the line can be removed and have the same effect (causing all the exceptions to be considered "handled") as if the line was there.
The only time it would be useful is if the lambda could return false for some exceptions (which it doesn't in this case).
This say, that the Exception is handled, nothing else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With