Skip to content

Commit

Permalink
Improve GetCollectionItemType() regarding arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
skrysmanski committed May 6, 2024
1 parent 110d146 commit 8126858
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/AppMotor.Core/Extensions/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ public static bool IsNullableValueType(this Type type)
[MustUseReturnValue]
public static Type? GetCollectionItemType(this Type type)
{
if (type.IsArray)
{
return type.GetElementType();
}

var implementedIEnumerableInterfaceTypes = type.FindInterfaces(FindInterfacesFilter, null);

if (implementedIEnumerableInterfaceTypes.Length == 0)
Expand Down

0 comments on commit 8126858

Please sign in to comment.