Enumerable.TryGetNonEnumeratedCount<TSource> メソッド

定義

列挙型を強制せずに、シーケンス内の要素の数の測定を試みます。

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static bool TryGetNonEnumeratedCount(System::Collections::Generic::IEnumerable<TSource> ^ source, [Runtime::InteropServices::Out] int % count);
public static bool TryGetNonEnumeratedCount<TSource> (this System.Collections.Generic.IEnumerable<TSource> source, out int count);
static member TryGetNonEnumeratedCount : seq<'Source> * int -> bool
<Extension()>
Public Function TryGetNonEnumeratedCount(Of TSource) (source As IEnumerable(Of TSource), ByRef count As Integer) As Boolean

型パラメーター

TSource

source の要素の型。

パラメーター

source
IEnumerable<TSource>

カウントする要素が格納されているシーケンス。

count
Int32

このメソッドが戻るときに、内の要素 sourceの数を格納します。列挙なしでカウントを特定できなかった場合は 0 を格納します。

戻り値

Boolean

true 列挙なしでカウントを決定できる場合は。それ以外の source 場合は false

注釈

このメソッドは、一連の型テストを実行し、列挙せずにカウントを決定できる一般的なサブタイプを識別します。 これには、LINQ 実装で使用される 、ICollection内部型が含まれますICollection<T>

このメソッドは通常、定数時間操作ですが、最終的には、基になるコレクションの実装の複雑さの特性に依存します。

適用対象