Smash test
test debug Result Disctinct by selector Refactoring Smash/Challonge Test Resultat Html for Kiouze
This commit is contained in:
23
LaDOSE.Src/LaDOSE.Service/Helper/DistinctBy.cs
Normal file
23
LaDOSE.Src/LaDOSE.Service/Helper/DistinctBy.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LaDOSE.Business.Helper
|
||||
{
|
||||
public static class DataHelper
|
||||
{
|
||||
public static IEnumerable<T> DistinctBy<T,TKey>(this IEnumerable<T> lst,Func<T,TKey> dist)
|
||||
{
|
||||
var seen = new HashSet<TKey>();
|
||||
foreach (var e in lst)
|
||||
{
|
||||
|
||||
if (!seen.Contains(dist(e)))
|
||||
{
|
||||
seen.Add(dist(e));
|
||||
yield return e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user