BEGIN USING declaration
statements
END USING
declaration | Declaration of a variable and assignment that |
statements | Code including one or more statements that may contain unsafe code. |
When the lifetime of an IDisposable object is limited to a single method, you should declare and instantiate it in the using statement. The using statement calls the Dispose method on the object in the correct way, and (when you use it as shown earlier) it also causes the object itself to go out of scope as soon as Dispose is called. Within the using block, the object is read-only and cannot be modified or reassigned.
Example
BEGIN USING VAR oTest := Test{}
oTest:DoSomething()
END USING
this is the equivalent of:
VAR oTest := Test{}
TRY
oTest:DoSomething()
FINALLY
IF oTest != NULL_OBJECT
((IDisposable)oTest):Dispose()
ENDIF
END TRY