title: setIfNull Extention Method will not set the value to the object
body: <p>I want to create a generic extension method that will set a value to an Object or a Struct if their value equals to their default value.</p>
  
  <p>so i have the following code:</p>
  
  <pre><code>public static void setIfNull&lt;T&gt;(this T i_ObjectToUpdate, T i_DefaultValue)
  {
      if (EqualityComparer&lt;T&gt;.Default.Equals(i_ObjectToUpdate, default(T)))
      {
          i_ObjectToUpdate = i_DefaultValue;
      }
  }
  </code></pre>
  
  <p>and here is a call example:</p>
  
  <pre><code>public OrganizationalUnit CreateOrganizationalUnit(OrganizationalUnit i_UnitToCreate)
  {
      i_UnitToCreate.EntityCreationDate.setIfNull(DateTime.Now); //Here is a call
      i_UnitToCreate.EntityLastUpdateDate.setIfNull(DateTime.Now); //And another one
      m_Context.DomainEntities.Add(i_UnitToCreate);
      return i_UnitToCreate;
  }
  </code></pre>
  
  <p>I don't know if it have anything to do with it but i use entity framework and MVC.</p>
  
  <p>What actually happens in a debugger I see that the line in the extension method <code>i_ObjectToUpdate = i_DefaultValue;</code> is working and the values are changes but when the debugger gets out of the extension method I see that the value of <code>i_UnitToCreate.EntityCreationDate</code> remains unchaged.</p>
  
  <p>Any ideas what went wrong ?</p>