I'm not aware of a more elegant solution than either:
- Create a data table with two columns (I assume you know how to do this); or
- Make a data class that contains the two items and make a list of those.
class QuotationTransporter {
public Quotation Quotation { get; set; }
public Transporter Transporter { get; set; }
public QuotationTransporter(Quotation q, Transporter t){
Quotation = q; Transporter = t;
}
}
List<QuotationTransporter> Merge(List<Quotation> q, <Transporter> t){
if(q.Count != t.Count) throw new ArgumentException("Lists must be same length");
List<QuotationTransporter> r = new List<QuotationTransporter>(q.Count);
for(int i = 0; i < q.Count; i++)
r.Add(new QuotationTransporter(q[i], t[i]);
return r;
}
It feels like it should be possible with a LINQ join query, though. Perhaps one of the LINQ gurus will come around and demonstrate that.