public virtual object Clone() { var result = MemberwiseClone() as Shipment; result.DeliveryAddress = DeliveryAddress?.Clone() as Address; result.Items = Items?.Select(x => x.Clone()).OfType <ShipmentItem>().ToList(); result.Discounts = Discounts?.Select(x => x.Clone()).OfType <Discount>().ToList(); result.TaxDetails = TaxDetails?.Select(x => x.Clone()).OfType <TaxDetail>().ToList(); result.DynamicProperties = DynamicProperties?.Select(x => x.Clone()).OfType <DynamicObjectProperty>().ToList(); return(result); }
/// <summary> /// Create a shallow copy of object. /// </summary> /// <returns>new Person object.</returns> public override object Clone() { var clone = (Person)base.Clone(); if (DeliveryAddress != null) { clone.DeliveryAddress = (Address)DeliveryAddress.Clone(); } if (Profile != null) { clone.Profile = (PersonProfile)Profile.Clone(); } return(clone); }
public override object Clone() { var result = base.Clone() as Shipment; result.DeliveryAddress = DeliveryAddress?.Clone() as Address; result.ShippingMethod = ShippingMethod?.Clone() as ShippingMethod; result.CustomerOrder = CustomerOrder?.Clone() as CustomerOrder; result.Items = Items?.Select(x => x.Clone()).OfType <ShipmentItem>().ToList(); result.Packages = Packages?.Select(x => x.Clone()).OfType <ShipmentPackage>().ToList(); result.InPayments = InPayments?.Select(x => x.Clone()).OfType <PaymentIn>().ToList(); result.Discounts = Discounts?.Select(x => x.Clone()).OfType <Discount>().ToList(); result.TaxDetails = TaxDetails?.Select(x => x.Clone()).OfType <TaxDetail>().ToList(); return(result); }