Hello, I have a LINQ query as follows
m_FOO = rawcollection.Select(p=> p.Split(' ')).Select(p =>
{
int thing = 0;
try
{
thing = CalculationThatCanFail(p[1]);
}
catch{}
return new { Test = p[0], FooThing = thing};
})
.GroupBy(p => p.Test)
.ToDictionary(p => p.Key, s => s.Select(q => q.FooThing).ToList());
So, the CalculationThatCanFail throws sometimes. I don't want to put null in and then filter that out with another Where statement later, and a junk value is equally unacceptable. Does anyone know how to handle this cleanly? Thanks.
EDIT: There's a good reason for the double Select statement. This example was edited for brevity