このコードの結果、shipment.Items.Count と combinedShipment.Items.Count の両方がゼロになるのはなぜですか?
private static InboundShipment CombineLikeIsbns(InboundShipment shipment)
{
// shipment.Items has a count of 3
var distinctIsbns = shipment.Items.Select(i => i.ISBN).Distinct().ToList();
var combinedShipment = shipment;
combinedShipment.Items = new List<InboundShipmentItem>();
// Now both combinedShipment and shipment have an empty List in the .Items property
...
return combinedShipment;
}
[編集] そして、combinedShipment.Items を同じに設定したときに、shipment.Items が新しいリストに設定されないようにするにはどうすればよいですか?