I need to create a new instance of this class and add it to the property array…
Something like:
Public Class TSocket
Public Sub DoSomething()
System.DebugLog "Boo"
End Sub
End Class
Private Property arrTSocket() As Tsocket
Private Sub AddNewTSocket()
Var ts As New TSocket
arrTSocket.Add ts // put it in the array
ts.DoSomething // call something there
End Sub
On the first line, your using TwilioSocket as a singe value. But you also have a propery which is an array that has the same name. Use some other name on that first line. You may want to Var a local variable to do it, since you’re going to add it to the array anyway.
// This is the same but optimized (no need to fetch the recent object from the array)
Var ts As New clsTwilioSocket
TwilioSocket.Add(ts)
ts.Startup(eMFA_Transaction.RowID, TwilioSocket.LastIndex )
By the way, having a method passing the index of self does not make a lot of sense, probably passing the ref of the obj (self) around would be better (making this specific call even shorter and faster)… But without knowing the logic involved here I’m not sure.
It would end as:
Var ts As New clsTwilioSocket
TwilioSocket.Add(ts)
ts.Startup(eMFA_Transaction.RowID) // Startup just knows self (the ts instance)