B4J Question Porting VB.NET Structure?

Discussion in 'B4J Questions' started by ShaneG30, Mar 20, 2015.

  1. ShaneG30

    ShaneG30 Well-Known Member Licensed 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:

    Code:
    '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.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can use a custom type for this:
    Code:
    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:
    Code:
    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
     
    ShaneG30 likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice