I know this is the VB languages new group. I have a .NET library (DLL)
written in C#. I am adding examples to my documentation for my VB users. I
have a VB example that will not compile.
C# struct and enum:
using System;
namespace VLib
{
public enum Types : sbyte
{
T1, T2, T3, T4,
}
public struct T
{
public ushort x;
public Types t;
public T( ushort x, Types t )
{
this.x = x;
this.t = t;
}
}
}
Compiles no errors.
Visual Basic Code:
Option Strict Off
Imports Vlib
Module Module1
Sub Main()
' The following errors occur on the definition below.
' Value of type 'Integer' cannot be converted to 'System.UInt16'.
' Value of type 'Byte' cannot be converted to 'VLib.Types'.
Dim q As VLib.T = New VLib.T(10, Types.T2)
End Sub
End Module
Ok What is going on here?
Do I need to cast the literal 10 to System.UInt16?
Why does VB think Types.T2 is of type BYTE and not of tyoe Types?