Function using

  • Execute a function with a disposable resource and clean up after the function scope ends.

    Returns

    Result of function

    Type Parameters

    Parameters

    • resource: T

      Disposable resource

    • body: ((resource: T) => U)

      function to execute with resource

        • (resource: T): U
        • Parameters

          • resource: T

          Returns U

    Returns U