My dream is something like a "New"- keyword in VB.net ;-)
Also every type-definition could create in the background a Sub like "New +Typename"
Also every type-definition could create in the background a Sub like "New +Typename"
B4X:
Type MyObject (Name As String, Height As Int, Width As Int, Color As Int)
Sub Sammple
Dim sb As StringBuilder : sb.Initialize
Dim obj1 As MyObject = NewMyObject("sample", 100, 100, Colors.Green) 'same parameters like in type-definition
End Sub
Sub NewMyObject(name As String, height As Int, width As Int, color As Int) As MyObject
Dim t As MyObject
t.Name = name
t.Height = height
t.Width = width
t.Color = color
Return t
End Sub
'same sample with New
Sub Sample
Dim sb As New StringBuilder
Dim obj1 As New MyObject("sample", 100, 100, Colors.Green) 'same parameters like in type-definition
End Sub