Skip to content

Commit

Permalink
Solves #703
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Pignatelli authored and adecler committed Aug 3, 2019
1 parent 0391105 commit 35742ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Reflection_Engine/Query/UnderlyingType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit 35742ea

Please sign in to comment.