title: Accepting a Byte array, vb6 to C# interop
body: <p>I am doing an application that comunicates vb6 with a cryptographic wrapper. The .net and interop part, up to now, is alright, fully working.<br>
  As my client is testing It, I just have a quick question:</p>
  
  <pre><code>[ComVisible(true)]
  public SomeObjectComVisible GetThat(byte[] array){ ... }
  </code></pre>
  
  <p>I used, until now, either types that I exposed to com or int and string, and no problems until now.</p>
  
  <p>Is it ok to use (.net) <code>byte</code> or chould I use <code>*char</code>?<br>
  When I mark the assembly to be visible and register to com interop, it creates a wrapper for it, or should I use some unmanaged type?</p>
  
  <p>Ah, it is a vb6, not vbscript.</p>
  
  <p>thanks a million</p>
  
  <p>for those who seek the answer:</p>
  
  <pre><code>public SomeObjectComVisible GetThat([MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UI1)]byte[] array)
  </code></pre>
  
  <p>the problem is with arrays.
  <a href="http://msdn.microsoft.com/en-us/library/z6cfh6e6.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/z6cfh6e6.aspx</a>
  and 
  <a href="http://msdn.microsoft.com/en-us/library/75dwhxf7.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/75dwhxf7.aspx</a></p>
  
  <p>Any non bittable type can be a chore. You can specify your own types so they are used, you just have to make use of</p>
  
  <pre><code>[ComVisible(true), 
  ClassInterface(ClassInterfaceType.None),
  ProgId("SomeNamespace.SomeClass"),
  Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")]
  </code></pre>
  
  <p>on top of the class</p>
  
  <p>Thank you very much you all. </p>
  
  <p>Great help</p>