title: Does it make any difference to use unsafe inside or outside a loop?
body: <p>I never needed to use unsafe in the past, but now I need it to work with a pointer manipulating a bitmap.</p>
  
  <p>I couldn't find any documentation that indicates otherwise, but I would like to understand better how unsafe works and if it makes any difference to use it inside or outside a loop.</p>
  
  <p>Is it better to do:</p>
  
  <pre><code>unsafe
  {
      for (int x = 0; x &lt; maxX; x++)
      {
          for (int y = 0; y &lt; maxY; y++)
          {           
              //Unsafe pointer operations here.
          }
      }
  }
  </code></pre>
  
  <p>Or to do?:</p>
  
  <pre><code>for (int x = 0; x &lt; maxX; x++)
  {
      for (int y = 0; y &lt; maxY; y++)
      {   
          unsafe
          {       
              //Unsafe pointer operations here.
          }
      }
  }
  </code></pre>