Eradicate ☠ Mono ☠

Co-Authored-By: Gustas <37534529+punkpun@users.noreply.github.com>
This commit is contained in:
michaeldgg2
2024-09-13 23:01:58 +02:00
committed by Pavel Penev
parent 5450572e0a
commit c7cc9a68fd
35 changed files with 89 additions and 634 deletions

View File

@@ -497,22 +497,4 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
Map.ActorDefinitions = Map.ActorDefinitions.Concat(nodes).ToArray();
}
}
#if !NET6_0_OR_GREATER
public static class Extensions
{
/// <summary>
/// Only used for Mono builds. .NET 6 added the exact same thing.
/// </summary>
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
{
var knownKeys = new HashSet<TKey>();
foreach (var element in source)
{
if (knownKeys.Add(keySelector(element)))
yield return element;
}
}
}
#endif
}