WeakRef.Constructor(obj as Object)

From Xojo Documentation


WeakRef.Constructor(obj As Object)

Creates a WeakRef instance.


The target object that you want to retain a reference to after it has been destroyed.


This example creates a weak reference to a SQLiteDatabase object. The property "db As SQLiteDatabase" is a property on the App object.

Var dbRef As WeakRef

// Create Database Object
DB = New SQLiteDatabase
dbRef = New WeakRef(DB)
// Set Database File
DB.DatabaseFile = New FolderItem("MyDatabase.sqlite")