How to marshal string array from C# to VB?
-
Hi i am writing a C# class library which i want to use in my VB Client So i wrote class like this [Guid("0AA209CD-D713-4336-8804-F7D4888F58BD")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown )] [ComVisible(true)] public interface IClass1 { void Temp1([MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr )] String[] IDs,int size); } [Guid("CCDAD140-DD55-4047-A925-A1B539396A01")] [ComVisible(true)] [ProgId("CommonCatalogue.Class1")] public class Class1:IClass1 { public void Temp1([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] String[] IDs, int size) { string TempDate = "dfdf"; } } but when i referenced this library (.tlb) in VB the temp method singnature coming as Temp1(IDs As String, size As Long) i am unable to fix this. Please can any one help me in figuring out this.
-
Hi i am writing a C# class library which i want to use in my VB Client So i wrote class like this [Guid("0AA209CD-D713-4336-8804-F7D4888F58BD")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown )] [ComVisible(true)] public interface IClass1 { void Temp1([MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr )] String[] IDs,int size); } [Guid("CCDAD140-DD55-4047-A925-A1B539396A01")] [ComVisible(true)] [ProgId("CommonCatalogue.Class1")] public class Class1:IClass1 { public void Temp1([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr)] String[] IDs, int size) { string TempDate = "dfdf"; } } but when i referenced this library (.tlb) in VB the temp method singnature coming as Temp1(IDs As String, size As Long) i am unable to fix this. Please can any one help me in figuring out this.
-
As far as i know, vb uses the SafeArray (UnmanagedType enumeration[^])