我有一份名单,显示视频Game:
public class VideoGame{
public string Title;
public string Platform;
public string PublishingCompany;
public int InStock; //this is how many that we have in stock
public decimal Price;
public int GameID; //this is the ID of a specific title. For example: all DOOM games have id of say 234 regardless of platform.
//etc.
}
我想获得我们用简明的素福和林研中心为某种游戏所储存的录像气总量。
我尝试:
int stock = ListOfGames.Sum(e=>e.InStock == GameID);
//GameID is a param that refers to the id of the game.
但这不能回去正确的价值。
我研究了这个问题:。 采用LINQ的特性摘要,但不帮助。 关于如何为某个动物群集所有游戏的总和的想法?