<PackageReference Include="NUnit" Version="4.1.0" />

IEnumerableExtensions

static class IEnumerableExtensions
using System; using System.Collections; using System.Collections.Specialized; using System.Linq; using System.Runtime.CompilerServices; namespace NUnit.Framework.Internal.Extensions { internal static class IEnumerableExtensions { [System.Runtime.CompilerServices.NullableContext(2)] public static bool IsSortable(this IEnumerable collection) { if (collection == null) return false; if (collection is StringCollection) return true; Type type = collection.GetType(); Type type2 = type.GetInterfaces().FirstOrDefault(delegate(Type i) { if (i.IsGenericType && i.Namespace == "System.Collections.Generic") return i.Name == "IEnumerable`1"; return false; }); return (((object)type2 != null) ? type2.GetGenericArguments().FirstOrDefault() : null)?.IsSortable() ?? false; } } }