B4J Question Porting VB.NET Structure?

LWGShane

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:

B4X:
'Credit goes to Chadderz for this compressor included in CTools.
'http://wiki.tockdom.com/wiki/User:Chadderz
        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

Thanks.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use a custom type for this:
B4X:
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:
B4X:
Sub NewContraction(Loc As Int, sz As Int, off As Int) As Contraction
 Dim c As Contration
 c.Initialize
 c.Location = Loc
 c.Size = sz
 c.Offset = off
 Return c
End Sub
 
Upvote 0
Top