And I took the path less traveled by...
Evaluate the following approaches:
List<Address> addresses = new List<Address>();
addresses.Add(customer.HomeAddress);
addresses.Add(customer.BusinessAddress);
addresses.Add(customer.ShippingAddress);
addresses.RemoveAll(delegate(Address a) { return a == null; });
And:
List<Address> addresses = new List<Address>();
if (customer.HomeAddress != null)
addresses.Add(customer.HomeAddress);
if (customer.BusinessAddress != null)
addresses.Add(customer.BusinessAddress);
if (customer.ShippingAddress != null)
addresses.Add(customer.ShippingAddress);
Which do you think that I used? Which would you rather use?

Comments
Comment preview