S/O で同様のエラーが発生しましたが、修正は簡単ではありませんでした。
Cannot implicitly convert type 'System.Collections.Generic.List<AnonymousType#1>' to 'System.Collections.Generic.List<DTD.ManagedMPS.Core.EtchVectorShapes>'
このlinqクエリを特定のリストとして渡すために何をする必要がありますか?
public List<EtchVectorShapes> GetEtchVectors(List<ViolationType> list, List<ExcelViolations> excelViolations)
{
var etchVector = new List<EtchVectorShapes>();
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
{
EtchVectors = vio.EtchVects // firstOrDefault.Formatted
}).ToList();
return etchVector;
}