title: What exactly is 'fixed' doing?
body: <p>I have some code that looks like this, in an unsafe context:</p>
  
  <pre><code> ValidatePartialOperation(array, startingOffset, runLength);
  
   fixed (double* _op = array)
   {
       double* op = _op + startingOffset;
       callSomething(op, runLength);
   }
  </code></pre>
  
  <p>And I have that copy+pasted in a couple of different places.  But I hate having that kind of validation and pointer arithmetic in multiple places, so I'd like to combine together the logic in to a single line that looks something like:</p>
  
  <pre><code> double* op = preCall(array, startingOffset, runLength);
   callSomething(op, runLength);
   postCall(array);
  </code></pre>
  
  <p>Or even better:</p>
  
  <pre><code> using (double* op = preCall(array, startingOffset, runLength))
   {
       callSomething(op, runLength);
   }
  </code></pre>
  
  <p>But whatever happens I can't afford to lose performance from the 'fixed' version.</p>
  
  <p>My plan right now is to mimic what the fixed statement is doing, but I don't actually know what that is.  Presumably some try-catch block with a pinning operation?</p>