using Function

A 'using' function which is a substitution for .NET's using statement. It makes sure that 'dispose' is called on the resource no matter if the func returns or throws. If func returns, the return value of this function is equal to return value of func. If func throws, this function also throws (after disposing the resource).

using<T extends IDisposable, TResult>(resources: T | T[], func: (...r: T[]) => TResult): TResult

Parameter Type Description
resources T | T[]  
func (...r: T[]) => TResult  

Returns - TResult

Defined in

Last Updated: 20 April, 2024