From 4dce7bddb44ffc569c8d9670c7e88511f56515af Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Thu, 25 May 2023 08:56:22 +0300 Subject: [PATCH] Update NuGet packages --- CliFx.Analyzers.Tests/CliFx.Analyzers.Tests.csproj | 4 ++-- CliFx.Analyzers/CliFx.Analyzers.csproj | 2 +- CliFx.Tests/CliFx.Tests.csproj | 6 +++--- CliFx/CliFx.csproj | 2 +- CliFx/Utils/Extensions/TypeExtensions.cs | 6 ++++-- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CliFx.Analyzers.Tests/CliFx.Analyzers.Tests.csproj b/CliFx.Analyzers.Tests/CliFx.Analyzers.Tests.csproj index bf4c11e..a162190 100644 --- a/CliFx.Analyzers.Tests/CliFx.Analyzers.Tests.csproj +++ b/CliFx.Analyzers.Tests/CliFx.Analyzers.Tests.csproj @@ -10,13 +10,13 @@ - + - + diff --git a/CliFx.Analyzers/CliFx.Analyzers.csproj b/CliFx.Analyzers/CliFx.Analyzers.csproj index ce60ebe..27c7df5 100644 --- a/CliFx.Analyzers/CliFx.Analyzers.csproj +++ b/CliFx.Analyzers/CliFx.Analyzers.csproj @@ -20,7 +20,7 @@ - + \ No newline at end of file diff --git a/CliFx.Tests/CliFx.Tests.csproj b/CliFx.Tests/CliFx.Tests.csproj index d879fa6..f2fc0e1 100644 --- a/CliFx.Tests/CliFx.Tests.csproj +++ b/CliFx.Tests/CliFx.Tests.csproj @@ -10,15 +10,15 @@ - + - + - + diff --git a/CliFx/CliFx.csproj b/CliFx/CliFx.csproj index d73c8e3..e4403c4 100644 --- a/CliFx/CliFx.csproj +++ b/CliFx/CliFx.csproj @@ -25,7 +25,7 @@ - + diff --git a/CliFx/Utils/Extensions/TypeExtensions.cs b/CliFx/Utils/Extensions/TypeExtensions.cs index ed27f9a..034b3c0 100644 --- a/CliFx/Utils/Extensions/TypeExtensions.cs +++ b/CliFx/Utils/Extensions/TypeExtensions.cs @@ -29,8 +29,10 @@ internal static class TypeExtensions .GetInterfaces() .Select(TryGetEnumerableUnderlyingType) .Where(t => t is not null) - .OrderByDescending(t => t != typeof(object)) // prioritize more specific types - .FirstOrDefault(); + // Every IEnumerable implements IEnumerable (which is essentially IEnumerable), + // so we try to get a more specific underlying type. Still, if the type only implements + // IEnumerable and nothing else, then we'll just return that. + .MaxBy(t => t != typeof(object)); } public static MethodInfo? TryGetStaticParseMethod(this Type type, bool withFormatProvider = false)