我有下面的代码,我需要添加一个额外的对象来从数据库检索结果后。任何想法,我可能如何呢?如何将其他对象添加到LINQ查询的结果中?
public IEnumerable<ProdPriceDisplay> GetShopProductsPrices()
{
//ProdPriceDisplay ProdPrice = new ProdPriceDisplay();
var Products = from shop in db.SHOPs
select new ProdPriceDisplay
{
ProdPrice = shop.S_NAME + " - £" + shop.S_PRICE
};
// *** Want to add something like this:-
// Products.Add new ProdPriceDisplay { ProdPrice = "some additional text"; }
return Products;
}
这对我也很有用 - 谢谢。 – Ebircsa 2008-11-18 10:46:55
是的,这是一个解决方案,但我建议Jon的,因为他提到了它的好处。 – 2008-11-18 12:08:51