B4J Question Porting VB.NET Structure?


Well-Known Member
Licensed User
Longtime User
I took a break from one of the apps I was working on and starting working on a personal app and am wanting to know how I could port this VB.NET Structure to B4J:

'Credit goes to Chadderz for this compressor included in CTools.
        Private Structure Contraction
            Public Location As Integer
            Public Size As Integer
            Public Offset As Integer

            Public Sub New(loc As Integer, sz As Integer, off As Integer)
                Location = loc
                Size = sz
                Offset = off
            End Sub
        End Structure



B4X founder
Staff member
Licensed User
Longtime User
You can use a custom type for this:
Type Contraction (Location As Integer, Size As Integer, Offset As Integer)

If you like you can create a sub that creates instances of this type:
Sub NewContraction(Loc As Int, sz As Int, off As Int) As Contraction
 Dim c As Contration
 c.Location = Loc
 c.Size = sz
 c.Offset = off
 Return c
End Sub
Upvote 0