Builder pattern with nested objects
Hi I'm stuck with a problem. I want to implement the builder pattern to make creating my objects easier. The problem I face has to do with nested object. The object I would like to create has a list of other objects in it, and I don't really have an idea on how to tackle it. I want to be able to do the following (Simpler objects for example): Receipt RestaurantReceipt = new ReceiptBuilder() .withDate("value") .withName("value") .AddItem("value") .WithIngredients("value") .WithType("value") .AddItem("value") .WithIngredients("value") .WithType("value") .build(); Or something like: Receipt