我有以下实体
public class A
{
public string TestMethodName { get; set; }
public string FailedFor { get; set; }
}
public class B
{
public string TestMethodName { get; set; }
public string FailedFor { get; set; }
}
我正在使用 Windows 窗体。如果我尝试按照以下方式执行联合
private void button2_Click(object sender, EventArgs e)
{
List<A> aCollection = new List<A>();
List<B> bCollection = new List<B>();
aCollection.Add(new A { TestMethodName = "Method1", FailedFor = "DPLServerURL" });
aCollection.Add(new A { TestMethodName = "Method2", FailedFor = "DPLServerURL" });
aCollection.Add(new A { TestMethodName = "Method3", FailedFor = "DPLServerURL" });
aCollection.Add(new A { TestMethodName = "Method4", FailedFor = "DPLServerURL" });
bCollection.Add(new B { TestMethodName = "Method1", FailedFor = "OrderXmlLocation" });
bCollection.Add(new B { TestMethodName = "Method2", FailedFor = "OrderXmlLocation" });
bCollection.Add(new B { TestMethodName = "Method5", FailedFor = "OrderXmlLocation" });
var xx = bCollection.Union(aCollection).ToList();
}
我收到错误作为 udner
Error 1 Instance argument: cannot convert from 'System.Collections.Generic.List<WindowsFormsApplication1.B>' to 'System.Linq.IQueryable<WindowsFormsApplication1.A>'
如何合并/合并这些实体?
谢谢