title: C# Code size and Code execution time
body: <p>Is there any way to find what is a size of a code and what is its execution time so I can compare two codes and decide which is better?</p>
  
  <p>For example lets say I want to find the size and execution time of this</p>
  
  <p>Code 1</p>
  
  <pre><code>for(int i=0; i&lt;5; i++)
  {
     sum+=1;
  }
  </code></pre>
  
  <p>and this</p>
  
  <p>Code 2</p>
  
  <pre><code>for(int i=0; i&lt;=4; i++)
  {
     sum = sum + 1;
  }
  </code></pre>
  
  <p>to decide which is better (I don't care about this example now). For example the result will be:</p>
  
  <pre><code>Code 1:
  Size: ? KB
  Time: ? ms
  
  Code 2:
  Size: ? KB
  Time: ? ms
  </code></pre>