title: what is the equivalent to passing by address in c#
body: <pre><code>void Afunction(int* outvar)
  {
      if(outvar)
          *outvar = 1337;
  }
  </code></pre>
  
  <p>note the qualities: it allows you to optionally pass a variable by reference, so that it can be set by the function.</p>
  
  <p>my closest guess would be (ref int? outvar)</p>
  
  <p>but that produces ref (int?)  NOT (ref int)? which is what I need</p>
  
  <p>this functionality is hardly a scarcely used feature of c or c++, so I assume there must be some equivalent? 
  Edit:
  so let me try a good example, I think a Colision check function is a prime example, where you have the primary test being whether or not two objects are in contact, then the optional output of the projection vector, calculating the projection vector takes extra time, so you only want to do it if they want it, on the other hand, it usually uses alot of the info calculated when doing the collision test. </p>
  
  <pre><code>bool Collide(colObject obj1, colObject obj2, Vector3* projection)
  {
  
      //do a bunch of expensive operations to determine if there is collision
      if(!collided)return false;
      if(projection != NULL)
      {
          //do more expensive operations, that make use of the above operations already done,
          //to determine the proj vect
          *proj = result;
      }
      return true;
  }
  </code></pre>
  
  <p>note that I am currently just porting c++ code to c#, so I might not have though of any real 'out of the box' solutions</p>