using uCalcSoftware; var uc = 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. var t = new uCalc.Transformer(uc); var 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 (var TempTransform = new uCalc.Transformer(uc)) { Console.WriteLine(TempTransform.MemoryIndex == MemIndex); // MemoryIndex() will be the recycled value of the released t object } // TempTransform goes out of scope here var t3 = new uCalc.Transformer(uc); Console.WriteLine(t3.MemoryIndex == MemIndex); // MemoryIndex() will be the recycled value of the released TempTransform object t3.Release(); { // Use "using" so that the object is auto-released when it it goes out of scope var StickyTransformer = new uCalc.Transformer(uc); Console.WriteLine(StickyTransformer.MemoryIndex == MemIndex); } // StickyTransformer remains in memery var t4 = new uCalc.Transformer(uc); Console.WriteLine(t4.MemoryIndex == MemIndex); // False since StickyTransformer was not released; MemoryIndex() has a new value