Throwing an AggregateException in my own code
Posted
by Pat
on Stack Overflow
See other posts from Stack Overflow
or by Pat
Published on 2010-06-11T19:09:24Z
Indexed on
2010/06/11
19:12 UTC
Read the original article
Hit count: 161
How should I go about collecting exceptions and putting them into an AggregateException to re-throw?
For my specific code, I have a loop and will have zero or more exceptions thrown from a part of the code. I was hoping to just add the new exceptions to the AggregateException as they arise, but the documentation sort of indicates that it should be constructed with all the Exceptions at once (there is no method to add an Exception to the object).
And what about creating a new AE every time and just including the previous AE in the list of exceptions? Seems a hokey way to do it.
Any better ideas?
© Stack Overflow or respective owner