/// <summary> /// Returns the number of elements in an option. /// </summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source"/>.</typeparam> /// <param name="source">A source option.</param> /// <returns>1 if <paramref name="source"/> contains an element; otherwise, 0.</returns> /// <exception cref="ArgumentNullException"><paramref name="source"/> is <see langword="null"/>.</exception> public static long LongCount <TSource>(this IOpt <TSource> source) => source.Count();
/// <summary> /// Returns the number of elements of an option that satisfy a predicate. /// </summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source"/>.</typeparam> /// <param name="source">A source option.</param> /// <param name="predicate">A function to test each element for a condition.</param> /// <returns> /// 1, if <paramref name="source"/> contains an element that satisfies <paramref /// name="predicate"/>; otherwise, 0. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="source"/> or <paramref name="predicate"/> is <see langword="null"/>. /// </exception> public static long LongCount <TSource>(this IOpt <TSource> source, Func <TSource, bool> predicate) => source.Count(predicate);