如何寫VB這個代碼如何將vb中的struct從c#轉換成?
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int X;
public int Y;
public static implicit operator Point(POINT point)
{
return new Point(point.X, point.Y);
}
}
我已經嘗試這一點,但它不工作
<StructLayout(LayoutKind.Sequential)> _
Public Structure POINT
Public X As Integer
Public Y As Integer
Public Shared Widening Operator CType(point As POINT) As Point
Return New Point(point.X, point.Y)
End Operator
End Structure
我得到這個兩個錯誤:
Error 1 Conversion operators cannot convert from a type to the same type.
Error 2 Type 'MousePosition.Form1.POINT' has no constructors.
是否有可能繼承結構在它自我在VB?
VB是不區分大小寫一次,你必須給參數和類型或者不同的名稱或不同的命名空間 –