Asserts that a source sequence contains a given count of elements.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public static IEnumerable<TSource> AssertCount<TSource>( this IEnumerable<TSource> source, int count )
<ExtensionAttribute> _ Public Shared Function AssertCount(Of TSource) ( _ source As IEnumerable(Of TSource), _ count As Integer _ ) As IEnumerable(Of TSource)
public: [ExtensionAttribute] generic<typename TSource> static IEnumerable<TSource>^ AssertCount( IEnumerable<TSource>^ source, int count )
Generic Template Parameters
- TSource
- Type of elements in source sequence.
Parameters
- source (IEnumerable<(Of <(<'TSource>)>)>)
- Source sequence.
- count (Int32)
- Count to assert.
Return Value
Returns the original sequence as long it is contains the
number of elements specified by count.
Otherwise it throws Exception.
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 uses deferred execution and streams its results.
Assembly: MoreLinq (Module: MoreLinq.dll) Version: 1.0.16006.0 (1.0.16006.1845)