title: Read and compare vs Rewrite efficiency in C#
body: <p>The question is, is it more efficient to rewrite a variable than to read an compare it?</p>
  
  <p>Lets say you have the following codes:</p>
  
  <p>Code 1</p>
  
  <pre><code>int x = 0;
  
  for( int i = 1; i &lt;= 10000; i++ )
  {
      x = 333;
  }
  </code></pre>
  
  <p>Code 2</p>
  
  <pre><code>int x = 0;
  
  for( int i = 1; i &lt;= 10000; i++ )
  {
      if( x != 333 )    
          x = 333;
  }
  </code></pre>
  
  <p>Which code is more efficient? </p>