mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 20:54:58 +00:00
Shorthand extension method for ordering a sequence by a comparer
This commit is contained in:
@@ -508,6 +508,24 @@ namespace ICD.Common.Utils.Extensions
|
|||||||
return extends.OrderBy(i => i);
|
return extends.OrderBy(i => i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shorthand for ordering the given sequence with the given comparer.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="extends"></param>
|
||||||
|
/// <param name="comparer"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IEnumerable<T> OrderBy<T>(this IEnumerable<T> extends, IComparer<T> comparer)
|
||||||
|
{
|
||||||
|
if (extends == null)
|
||||||
|
throw new ArgumentNullException("extends");
|
||||||
|
|
||||||
|
if (comparer == null)
|
||||||
|
throw new ArgumentNullException("comparer");
|
||||||
|
|
||||||
|
return extends.OrderBy(i => i, comparer);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns every item in the sequence except the given item.
|
/// Returns every item in the sequence except the given item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user