I have a legacy VB6 application that has the following structure defined:
Public Type DrawDown
Date As Date
Amount As Currency
CapitaliseInterest As Boolean
End Type
An interop assembly is generated using tlbimp.exe but the structure ends up as the following:
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct DrawDown
{
public DateTime Date;
[MarshalAs(UnmanagedType.Currency)]
public decimal Amount;
public short CapitaliseInterest;
}
I’m using .NET 4.0.
Why does the VB6 Boolean get translated to a C# short instead of a bool?
VB6 uses the VARIANT_BOOL type,
find info and history about it here: BOOL vs. VARIANT_BOOL vs. BOOLEAN vs. boo