MoreLinq
Acquire<(Of <(<'TSource>)>)> Method (source)
NamespacesMoreLinqMoreEnumerableAcquire<(Of <<'(TSource>)>>)(IEnumerable<(Of <<'(TSource>)>>))
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.
Declaration Syntax
C#Visual BasicVisual C++
public static TSource[] Acquire<TSource>(
	this IEnumerable<TSource> source
)
where TSource : IDisposable
<ExtensionAttribute> _
Public Shared Function Acquire(Of TSource As IDisposable) ( _
	source As IEnumerable(Of TSource) _
) As TSource()
public:
[ExtensionAttribute]
generic<typename TSource>
where TSource : IDisposable
static array<TSource>^ Acquire(
	IEnumerable<TSource>^ source
)
Generic Template Parameters
TSource
Type of elements in source sequence.
Parameters
source (IEnumerable<(Of <(<'TSource>)>)>)
Source sequence of IDisposable objects.
Return Value
Returns an array of all the acquired IDisposable object and 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<(Of <(<'TSource>)>)>. When you use instance method syntax to call this method, omit the first parameter.
Remarks
This operator executes immediately.

Assembly: MoreLinq (Module: MoreLinq.dll) Version: 1.0.16006.0 (1.0.16006.1845)