Language-specific auto-releasing of Item object

ID: 99

				
					using uCalcSoftware;

var uc = new uCalc();
// Language specific - auto-releasing Item object
Console.WriteLine("auto-releasing Item (language-specific)");

{ // MyVar resources will NOT be released when MyVar goes out of scope
   var MyVar = new uCalc.Item("Variable: x = 123");
   // Call MyVar.Release() explicitly if want to release it here
}

{ // MyVar resouces will be released automatically when MyVar goes of scope
   using var MyVar = new uCalc.Item("Variable: x = 123");

   // No need for MyVar.Release(), it will automatically be released
}

				
			
auto-releasing Item (language-specific)
				
					#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Language specific - auto-releasing Item object
   cout << "auto-releasing Item (language-specific)" << endl;

   { // MyVar resources will NOT be released when MyVar goes out of scope
      auto MyVar = new uCalc::Item("Variable: x = 123");
      // Call MyVar.Release() explicitly if want to release it here
   }

   { // MyVar resouces will be released automatically when MyVar goes of scope
      
      uCalc::Item MyVar("Variable: x = 123");
      // No need for MyVar.Release(), it will automatically be released
   }

}
				
			
auto-releasing Item (language-specific)
				
					Imports System
Imports uCalcSoftware
Public Module Program
   Public Sub Main()
      Dim uc As New uCalc()
      '// Language specific - auto-releasing Item object
      Console.WriteLine("auto-releasing Item (language-specific)")
      #If False
         { '// MyVar resources will NOT be released when MyVar goes out of scope
         Dim MyVar = new uCalc.Item("Variable: x = 123")
         '// Call MyVar.Release() explicitly if want to release it here
         }
         
         { '// MyVar resouces will be released automatically when MyVar goes of scope
         
         
         '// No need for MyVar.Release(), it will automatically be released
         }
         #End If
      End Sub
   End Module
				
			
auto-releasing Item (language-specific)