Ok, let's say that I have some C# code that filters or restructures an incoming object (or list of objects), like so:
public Customer GetCustomer()
{
var customer = _customerAdapter.GetCustomer();
ModifyCustomer(customer);
return customer;
}
private void ModifyCustomer(Customer c)
{
//some changes to customer object
}
This works, but I'd prefer a more functional approach to this, i.e. keep incoming customer and return a new (modified one).
Is deep cloning the way to go? Is it recommended when coding in C#?