-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