Click or drag to resize

MoreEnumerable.Acquire<TSource> Method

Ensures that a source sequence of IDisposable objects are all acquired successfully. If the acquisition of any one IDisposable fails then those successfully acquired till that point are disposed.

Namespace:  MoreLinq
Assembly:  MoreLinq (in MoreLinq.dll) Version: 3.1.0+ce7250fcae16725db4e3607598b1d4d8cb19957f
Syntax
public static TSource[] Acquire<TSource>(
	this IEnumerable<TSource> source
)
where TSource : IDisposable

Parameters

source
Type: System.Collections.Generic.IEnumerable<TSource>
Source sequence of IDisposable objects.

Type Parameters

TSource
Type of elements in source sequence.

Return Value

Type:TSource[]
Returns an array of all the acquired IDisposable objects in source order.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable<TSource>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
This operator executes immediately.
See Also