Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// In C# and VB you should use "using". '// In C++ you can flag a uCalc object for '// auto-release with Owned(), or by setting '// the last parameter of the constructor to true. Dim t As New uCalc.Transformer(uc) Dim MemIndex = t.MemoryIndex t.Release() '// MemIndex will be recycled and assigned to the next def '// Use "using" so that the object is auto-released when it it goes out of scope Using TempTransform As New uCalc.Transformer(uc) Console.WriteLine(TempTransform.MemoryIndex = MemIndex) '// MemoryIndex() will be the recycled value of the released t object End Using '// TempTransform goes out of scope here Dim t3 As New uCalc.Transformer(uc) Console.WriteLine(t3.MemoryIndex = MemIndex) '// MemoryIndex() will be the recycled value of the released TempTransform object t3.Release() If True Then '// Use "using" so that the object is auto-released when it it goes out of scope Dim StickyTransformer As New uCalc.Transformer(uc) Console.WriteLine(StickyTransformer.MemoryIndex = MemIndex) End If '// StickyTransformer remains in memery Dim t4 As New uCalc.Transformer(uc) Console.WriteLine(t4.MemoryIndex = MemIndex) '// False since StickyTransformer was not released; MemoryIndex() has a new value End Sub End Module