title: Where do I put DispID when a interace implements a interface for COM Interop
body: <p>I'm not 100% positive in my code that I'm doing this right. Basically I'm making a managed COM object/library in C#. I'm doing it this way so that if someone uses my SDK they are not bound to use .NET. After reading a bunch of articles I found out that I have to make a interface for my events if my main class is going to have events. <a href="http://msdn.microsoft.com/en-us/library/c3fd4a20.aspx" rel="nofollow" title="MSDN Article I read it from">MSDN Article I read that from</a> so I made my interface like so.</p>
  
  <pre><code>[ComVisible(true), 
  Guid("A34160EA-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), 
  InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
  public interface IBarcodeEvents
  {
      //should dispid be here?
      void BarcodeDataReceived(Interfaces.IBPBarcodeDevice device);
  }
  </code></pre>
  
  <p>Then I read that VB6 really needs/wants to have a DispID attribute. (A unique one per com object) but I'm confused. Do I put the DispId in my <code>IBarcodeEvents</code> or in <code>IBPBarcodeDevice</code> (comments removed for brevity)</p>
  
  <pre><code>[Guid("96CB4F45-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), ComVisible(true)]
  public interface IBPBarcodeDevice : IBarcodeEvents
  {
      [DispId(5001)]
      Data.BarcodeData GetBarcodeData();
      [DispId(5002)]
      bool HasBarcodeData();
      [DispId(5003)]
      void EnableBarcodeScanner();
      [DispId(5004)]
      void DisableBarcodeScaner();
  
      [DispId(5101)]
      event BarcodeDataReceivedHandler BarcodeDataReceived;
  }
  </code></pre>