How to copy an object by value, not by reference
<p>I want to make a copy of an object, then after some logic, re-assign the original object the value of the copy.</p>

<p>example:</p>

<pre><code>User userCopy = //make a copy

foreach(...)
{
  user.Age = 1;
  user.ID = -1;

  UserDao.Update(user)


  user = userCopy; 

}
</code></pre>

<p>I don't want a copy by reference, it has to be a copy by value.</p>

<p>The above is just a sample, not how I really want to use it but I need to learn how to copy by value.</p>
