title: Compiler Optimization on C# if/else
body: <p>I don't have too much knowledge of compilers and how .Net optimizes the generated machine code but would like to understand the following scenario: </p>
  
  <pre><code>    class AnyClass
      {
          public bool anyFlag;
          AnyClass()
          {
              anyFlag = true;
          }
  
          public void Action()        
          {
              if(anyFlag)
                   //Perform Certain Actions
          }
      }
  </code></pre>
  
  <p>anyFlag does not change throughout the scope of the program. Will the compiler generate MIL/machine code for Action method? If so will it have the if check in there?</p>