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, CalculationThatCanFail throws sometimes. I don't want to type null and then filter it with another Where statement, and the spam value is equally unacceptable. Does anyone know how to handle this? Thanks.
EDIT: There is a good reason for the double select statement. This example has been edited for brevity.
Steve source share