From b88babc54fb5badbbd89e2bbfbfaf209b1b3a309 Mon Sep 17 00:00:00 2001 From: FreddyD Date: Sat, 22 Feb 2020 02:07:27 -0500 Subject: [PATCH] Revert "Remove unused code" This reverts commit b0efbdf5e8c23d133cdf1cbca4b135a97bf5283a. --- src/Shared/SharedTypeExtensions.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Shared/SharedTypeExtensions.cs b/src/Shared/SharedTypeExtensions.cs index 3fe4acf..e73b132 100644 --- a/src/Shared/SharedTypeExtensions.cs +++ b/src/Shared/SharedTypeExtensions.cs @@ -63,6 +63,20 @@ namespace System && !type.IsInterface && (!type.IsGenericType || !type.IsGenericTypeDefinition); + public static bool IsGrouping(this Type type) => IsGrouping(type.GetTypeInfo()); + +#if NETCOREAPP3_1 + private static bool IsGrouping(TypeInfo type) + => type.IsGenericType + && (type.GetGenericTypeDefinition() == typeof(IGrouping<,>) + || type.GetGenericTypeDefinition() == typeof(SystemInteractiveAsync::System.Linq.IAsyncGrouping<,>)); +#else + private static bool IsGrouping(TypeInfo type) + => type.IsGenericType + && (type.GetGenericTypeDefinition() == typeof(IGrouping<,>) + || type.GetGenericTypeDefinition() == typeof(IAsyncGrouping<,>)); +#endif + public static Type UnwrapEnumType(this Type type) { var isNullable = type.IsNullableType();