/// <summary> /// Creates a deep clone of the current invoice (all fields and properties) /// </summary> public Invoice Clone() { new List <InvoiceLine>(this.LineItems.Count); var copyOfLineItems = LineItems.ConvertAll(i => { return(new InvoiceLine() { Cost = i.Cost, Description = i.Description, InvoiceLineId = i.InvoiceLineId, Quantity = i.Quantity }); }); return(new Invoice() { InvoiceNumber = this.InvoiceNumber, InvoiceDate = this.InvoiceDate, LineItems = copyOfLineItems }); }