mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Meta - Upgrade to .NET 6
This commit is contained in:
1 parent
33c54eaeb0
commit
d5d3530ca5
21 files changed
+21
-84
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<PreserveCompilationContext>false</PreserveCompilationContext>
|
||||
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
|
||||
<AssemblyTitle>Artemis.Core</AssemblyTitle>
|
||||
|
||||
@@ -30,69 +30,6 @@ namespace Artemis.Core
|
||||
// ReSharper disable once InconsistentNaming
|
||||
public static class IEnumerableExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns all distinct elements of the given source, where "distinctness"
|
||||
/// is determined via a projection and the default equality comparer for the projected type.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This operator uses deferred execution and streams the results, although
|
||||
/// a set of already-seen keys is retained. If a key is seen multiple times,
|
||||
/// only the first element with that key is returned.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TSource">Type of the source sequence</typeparam>
|
||||
/// <typeparam name="TKey">Type of the projected element</typeparam>
|
||||
/// <param name="source">Source sequence</param>
|
||||
/// <param name="keySelector">Projection for determining "distinctness"</param>
|
||||
/// <returns>
|
||||
/// A sequence consisting of distinct elements from the source sequence,
|
||||
/// comparing them by the specified key projection.
|
||||
/// </returns>
|
||||
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source,
|
||||
Func<TSource, TKey> keySelector)
|
||||
{
|
||||
return source.DistinctBy(keySelector, null!);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all distinct elements of the given source, where "distinctness"
|
||||
/// is determined via a projection and the specified comparer for the projected type.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This operator uses deferred execution and streams the results, although
|
||||
/// a set of already-seen keys is retained. If a key is seen multiple times,
|
||||
/// only the first element with that key is returned.
|
||||
/// </remarks>
|
||||
/// <typeparam name="TSource">Type of the source sequence</typeparam>
|
||||
/// <typeparam name="TKey">Type of the projected element</typeparam>
|
||||
/// <param name="source">Source sequence</param>
|
||||
/// <param name="keySelector">Projection for determining "distinctness"</param>
|
||||
/// <param name="comparer">
|
||||
/// The equality comparer to use to determine whether or not keys are equal.
|
||||
/// If null, the default equality comparer for <c>TSource</c> is used.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A sequence consisting of distinct elements from the source sequence,
|
||||
/// comparing them by the specified key projection.
|
||||
/// </returns>
|
||||
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(this IEnumerable<TSource> source,
|
||||
Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer)
|
||||
{
|
||||
if (source == null) throw new ArgumentNullException(nameof(source));
|
||||
if (keySelector == null) throw new ArgumentNullException(nameof(keySelector));
|
||||
|
||||
return _();
|
||||
|
||||
IEnumerable<TSource> _()
|
||||
{
|
||||
HashSet<TKey> knownKeys = new(comparer);
|
||||
foreach (TSource element in source)
|
||||
{
|
||||
if (knownKeys.Add(keySelector(element)))
|
||||
yield return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the index of the provided element inside the read only collection
|
||||
/// </summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
".NETCoreApp,Version=v5.0": {
|
||||
"net6.0": {
|
||||
"EmbedIO": {
|
||||
"type": "Direct",
|
||||
"requested": "[3.4.3, )",
|
||||
|
||||
Reference in new issue
Block a user