我的select語句不返回整個Customer對象,只有utrustningNr和開始。我如何返回它以正確的方式沒有得到這個錯誤:如何返回不完整的對象?
Cannot implicitly convert type 'System.Collections.Generic.List<AnonymousType#1>' to 'System.Collections.Generic.List<fjallvick.utrustning>
public List<utrustning> searchEquipment(string equipmentNr)
{
var queryEquipment = from utrustning in globalDBConnString.context.utrustnings
where utrustning.utrustningNr == equipmentNr
select (new { utrustning.utrustningNr, utrustning.beskrivning });
return queryEquipment.ToList();
}
更換新的'{...}'用'新utrustning {...}'。 – 2014-10-10 20:09:46