OptionExtensionsLinqGetNonEnumeratedCountT Method
Returns Some of the count of elements in the
collection if the count is readily available without enumeration;
None otherwise.
var array = new int[3] { 0, 1, 2 };
Assert.Equal(Some(3), array.GetNonEnumeratedCount());
var odds = array.Where(num => num % 2 == 1);
Assert.Equal(None<int>(), odds.GetNonEnumeratedCount());
Namespace: Orx.Fun.OptionAssembly: Orx.Fun.Option (in Orx.Fun.Option.dll) Version: 1.2.1+ea79806fa5e0e04bfdaef2a1916930e75e2cde74
public static Opt<int> GetNonEnumeratedCount<T>(
this IEnumerable<T> collection
)
- collection IEnumerableT
- Collection to get non-enumerated count of.
- T
- Element type.
OptInt32In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT. 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).