title: Build an object from another object in C# using generic code
body: <p>Let's say I have an object of Type User that looks like this:  </p>
  
  <pre><code>User {
     Name = "Bob",
     Email = "Bob@gmail.com",
     Class = NULL
  }
  </code></pre>
  
  <p>Can anyone think of a way to take that object and create an object like this:</p>
  
  <pre><code>User {
     Name = "Bob",
     Email = "Bob@gmail.com"
  }
  </code></pre>
  
  <p>Using entirely generic code?  Meaning, I don't want to hard code anything to do with the Type, or the Properties because this code would need to be applied to every Entity on my site.  (the "User" type is an Entity by the way, so use that if it helps you code this better).  </p>
  
  <p>I'm just trying to come up with a solution to a problem I have and I BELIEVE that <a href="http://blogs.msdn.com/b/alexj/archive/2009/06/19/tip-26-how-to-avoid-database-queries-using-stub-entities.aspx" rel="nofollow">Stub Entities</a> may fix the problem, but I need to do it without hard coding any Types or Properties.</p>