title: C# and void pointers
body: <p>I am writing my first C# application, but as luck would have it I must use void pointers (working with a DLL which returns handles). From what I read there are a few options:</p>
  
  <ol>
  <li><p>Unsafe code, for example see <a href="http://www.c-sharpcorner.com/UploadFile/gregory_popek/WritingUnsafeCode11102005040251AM/WritingUnsafeCode.aspx" rel="noreferrer">http://www.c-sharpcorner.com/UploadFile/gregory_popek/WritingUnsafeCode11102005040251AM/WritingUnsafeCode.aspx</a></p></li>
  <li><p>In the C# program writing in my function declerations IntPtr instead of void*. e.g.:
  public static extern char SupportsWhatever(IntPtr h);</p></li>
  <li><p>Using ref, e.g.:
  public static extern char SupportsWhatever(ref h);</p></li>
  </ol>
  
  <p>It should also be noted that I need to marshal information back and forth between the DLL and C# application.</p>
  
  <p>The unsafe option was the first that popped up on Google, but for some reason writing the keyword unsafe before all my functions just doesn't feel right.</p>
  
  <p>Any recommendations? </p>