Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit c9da83b

Browse files
committed
fix FirstGenericTypeDefinition
1 parent e9db172 commit c9da83b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/ServiceStack.Text/ReflectionExtensions.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,14 +1323,8 @@ public static TAttribute FirstAttribute<TAttribute>(this PropertyInfo propertyIn
13231323

13241324
public static Type FirstGenericTypeDefinition(this Type type)
13251325
{
1326-
while (type != null)
1327-
{
1328-
if (type.IsGenericTypeDefinition())
1329-
return type.GenericTypeDefinition();
1330-
1331-
type = type.BaseType();
1332-
}
1333-
return null;
1326+
var genericType = type.FirstGenericType();
1327+
return genericType != null ? genericType.GetGenericTypeDefinition() : null;
13341328
}
13351329

13361330
public static bool IsDynamic(this Assembly assembly)

0 commit comments

Comments
 (0)