Wish InitializeIfNeeded

Troberg

Well-Known Member
Licensed User
It's quite common to have code like this (snipped from a snippet elsewhere on the forum):

B4X:
If Not(L.IsInitialized) Then L.Initialize
Mostly, it's because of the Android app lifecycle, but sometimes I use it in other contexts as well, such as when loading settings, and if that failed, initialize to empty list/map.

The thing is, it's so common, that I think it would be nice to have a short form, in the form of a new initialize method:

B4X:
L.InitializeIfNeeded
 
Top