IEnumerableExtensionMinByTSource, TKey Method |
Gets the smallest item of the sequence using the comparer with the selector function returned values.
Namespace:
Gile.AutoCAD.R20.Extension
Assembly:
Gile.AutoCAD.R20.Extension (in Gile.AutoCAD.R20.Extension.dll) Version: 2.0.0.0 (2.0.0.0)
Syntaxpublic static TSource MinBy<TSource, TKey>(
this IEnumerable<TSource> source,
Func<TSource, TKey> selector,
IComparer<TKey> comparer = null
)
<ExtensionAttribute>
Public Shared Function MinBy(Of TSource, TKey) (
source As IEnumerable(Of TSource),
selector As Func(Of TSource, TKey),
Optional comparer As IComparer(Of TKey) = Nothing
) As TSource
public:
[ExtensionAttribute]
generic<typename TSource, typename TKey>
static TSource MinBy(
IEnumerable<TSource>^ source,
Func<TSource, TKey>^ selector,
IComparer<TKey>^ comparer = nullptr
)
[<ExtensionAttribute>]
static member MinBy :
source : IEnumerable<'TSource> *
selector : Func<'TSource, 'TKey> *
?comparer : IComparer<'TKey>
(* Defaults:
let _comparer = defaultArg comparer null
*)
-> 'TSource
Parameters
- source
- Type: System.Collections.GenericIEnumerableTSource
Sequence to which the method applies. - selector
- Type: SystemFuncTSource, TKey
Mapping function from TSource to TKey. - comparer (Optional)
- Type: System.Collections.GenericIComparerTKey
Comparer used for the TKey type; uses Comparer<TKey>.Default if null or omitted.
Type Parameters
- TSource
- Type the items.
- TKey
- Type of the returned value of selector function.
Return Value
Type:
TSourceThe smallest item in the sequence.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTSource. 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).
ExceptionsException | Condition |
---|
ArgumentNullException | Thrown if source is null. |
ArgumentNullException | Thrown if selector is null. |
See Also