mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-13 20:47:24 +00:00
Shorthand extension method for ordering a sequence by a comparer
This commit is contained in:
parent
60137254da
commit
c21b8d08da
1 changed files with 18 additions and 0 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue