Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "source/System/Disposable/dispose"

Index

Modules

Functions

Functions

using

  • using<TDisposable, TReturn>(disposable: TDisposable, closure: function): TReturn
  • Just like in C# this 'using' function will ensure the passed disposable is disposed when the closure has finished.

    Usage:

    using(new DisposableObject(),(myObj)=>{
      // do work with myObj
    });
    // myObj automatically has it's dispose method called.
    

    Type parameters

    Parameters

    • disposable: TDisposable

      Object to be disposed.

    • closure: function

      Function call to execute.

        • (disposable: TDisposable): TReturn
        • Parameters

          • disposable: TDisposable

          Returns TReturn

    Returns TReturn

    Returns whatever the closure's return value is.

Generated using TypeDoc