-1
我目前正在开发一个MVC Web应用程序,作为大学项目的一部分。我是从2个不同的Web API微服务检索2套的“产品”,两者有相同的“产品”,但有不同的价格,它们都使用了以下数据模型:C#在2个列表中找到最低价格
public int BrandId { get; set; }
public string BrandName { get; set; }
public int CategoryId { get; set; }
public string CategoryName { get; set; }
public string Description { get; set; }
public string Ean { get; set; }
public int Id { get; set; }
public bool InStock { get; set; }
public string Name { get; set; }
public double Price { get; set; }
我存储结果来自两个API的2个列表,但需要一种比较和从最便宜的价格中提取产品的方法,然后将其存储在单独的列表中。
同样值得注意的是'EAN'字符串在两个API中都是相同的。
我该怎么做呢?
谢谢。
那么,你通过比较两个列表中的每个实体并找出你需要的实体。 – AgentFire