【发布时间】:2019-08-29 05:28:21
【问题描述】:
如何复制更新并替换现有列表(这将删除所有项目并替换为新类)?两个列表都已声明。
public class ProductType1
{
public int ProductId { get; set; }
public string ProductName { get; set; }
public string ProductDescription { get; set; }
}
public class ProductType2
{
public int ProductId { get; set; }
public string ProductName { get; set; }
public string ProductDescription { get; set; }
public string ProductBarCodeNumber{ get; set; }
}
List<ProductType1> producttype1 = new List<ProductType1>()
List<ProductType2> producttype2 = new List<ProductType2>()
目的:将ProductType1全部删除,将ProductType2全部复制到ProductType1中,不包括ProductBarCodeNumber。
项目 ElectronicsStore 测试
【问题讨论】:
标签: c# linq generics .net-core