Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: T MaxCountElement<T>(this IEnumerable<T>, out int, IEqualityComparer<T>)

Declaration

public static T MaxCountElement<T>(
    this IEnumerable<T> source,
    out int count,
    IEqualityComparer<T> comparer = null
)

Summary

Determines which element occurs the most often in the specified input sequence, and how often.

Generic type parameters

T Type of elements in the input sequence.

Parameters

this IEnumerable<T>source Sequence to find most common element in.
out intcount Receives the number of times the element occurred.
IEqualityComparer<T>comparer Optional equality comparer to compare elements by.

Returns

Of all elements that occur the most number of times, the one whose last instance occurs soonest in the sequence.