Skip to content

Commit da28cde

Browse files
committed
fix GetEnumerableType to work with Net6 and to support types implementing multiple interfaces
1 parent c38c19e commit da28cde

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

dotnet/src/dotnetframework/GxClasses/Domain/GxCollections.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,10 +2684,12 @@ static public object ConvertToInternal(Type to, Object i)
26842684

26852685
static Type GetEnumerableType(Type type)
26862686
{
2687-
#if !NETCORE
2688-
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IEnumerable<>))
2689-
return type.GetGenericArguments()[0];
2690-
#endif
2687+
if (type.IsGenericType)
2688+
{
2689+
return type.GetInterfaces()
2690+
.FirstOrDefault(t => t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEnumerable<>))
2691+
?.GetGenericArguments()[0];
2692+
}
26912693
return null;
26922694
}
26932695

0 commit comments

Comments
 (0)