title: C#: How to pass null to a function expecting a ref?
body: <p>I've got the following function:</p>
  
  <pre><code>public static extern uint FILES_GetMemoryMapping(
      [MarshalAs(UnmanagedType.LPStr)] string pPathFile,
      out ushort Size,
      [MarshalAs(UnmanagedType.LPStr)] string MapName,
      out ushort PacketSize,
      ref Mapping oMapping,
      out byte PagesPerSector);
  </code></pre>
  
  <p>Which I would like to call like this:</p>
  
  <pre><code>FILES_GetMemoryMapping(MapFile, out size, MapName,
      out PacketSize, null, out PagePerSector);
  </code></pre>
  
  <p>Unfortunately, I cannot pass <code>null</code> in a field that requires type <code>ref Mapping</code> and no cast I've tried fixes this.</p>
  
  <p>Any suggestions?</p>