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: MoreLinqAssembly: MoreLinq (in MoreLinq.dll) Version: 4.0.0+092a40d82a1b280568ffa006d9a210bdec0792cd
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
)
[<ExtensionAttribute>]
static member Acquire :
source : IEnumerable<'TSource> -> 'TSource[] when 'TSource : IDisposable
- source IEnumerable<TSource>
- Source sequence of IDisposable objects.
- TSource
- Type of elements in source sequence.
TSource[]
Returns an array of all the acquired
IDisposable
objects in source order.
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).
This operator executes immediately.