As I am getting my Linq query to a functional point, I start looking at the query and think about all the "ANY" and wonder if those should be a different method and then I have data conversions going on.
Does anything jump out as being a performance issue? What is recommended to make this more performant? (Yes, I need all the &&
.)
etchVector =
from vio in list
where excelViolations.Any(excelVio => vio.VioID.Formatted.Equals(excelVio.VioID.ToString()))
&& excelViolations.Any(excelVio => vio.RuleType.Formatted.Equals(excelVio.RuleType))
&& excelViolations.Any(excelVio => vio.VioType.Formatted.Equals(excelVio.VioType))
&& excelViolations.Any(excelVio => vio.EtchVects.Any(x => x.XCoordinate.Equals(excelVio.XCoordinate)))
&& excelViolations.Any(excelVio => vio.EtchVects.Any(y => y.YCoordinate.Equals(excelVio.YCoordinate)))
select new EtchVectorShapes
{
VioID = Convert.ToInt32(vio.EtchVects.Select(x => x.VioID)),
ObjectType = vio.EtchVects.Select(x => x.ObjectType).ToString(),
XCoordinate = Convert.ToDouble(vio.EtchVects.Select(x => x.XCoordinate)),
YCoordinate = Convert.ToDouble(vio.EtchVects.Select(x => x.YCoordinate)),
Layer = vio.EtchVects.Select(x => x.Layer).ToString()
};
ToList()
call? This will (of course) freeze the enumerable contents at creation time, so maybe this is hat you require; but maybe not. \$\endgroup\$ – Pieter Geerkens May 11 '13 at 1:21