static AggregateException ThrowAggregatedException()
{
AggregateException eAgg = null;
try
{
Parallel.For( 0, 50, i =>
{
System.Threading.Thread.Sleep( 10 );
if( i % 2 == 0 ) throw new Exception( String.Format( "Ex n°{0}", i ), ThrowExceptionWithInner() );
else throw new Exception( String.Format( "Ex n°{0}", i ) );
} );
}
catch( AggregateException ex )
{
eAgg = ex;
}
return eAgg;
}