diff --git a/Reflection_Engine/Query/UnderlyingType.cs b/Reflection_Engine/Query/UnderlyingType.cs index b872cb3b7..7e301357b 100644 --- a/Reflection_Engine/Query/UnderlyingType.cs +++ b/Reflection_Engine/Query/UnderlyingType.cs @@ -39,10 +39,10 @@ public static partial class Query public static UnderlyingType UnderlyingType(this Type type) { int depth = 0; - while (type.GetGenericArguments().Count() == 1 && typeof(IEnumerable).IsAssignableFrom(type)) + while ((type.GetGenericArguments().Count() == 1 || type.GetElementType() != null) && typeof(IEnumerable).IsAssignableFrom(type)) { depth++; - type = type.GetGenericArguments().First(); + type = type.GetElementType() ?? type.GetGenericArguments().First(); } return new UnderlyingType { Type = type, Depth = depth };