Skip to content

Commit

Permalink
IsAssignableTo is internal and never called with null
Browse files Browse the repository at this point in the history
There is a IsAssignableTo in .NET 5.0 - the implementation is different. We need to clean the uses of this method if we want to expose it. Which is why I opened #151
  • Loading branch information
theraot committed Jan 29, 2021
1 parent c4f57d7 commit 3bfc66d
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions Framework.Core/System/Dynamic/Utils/TypeUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ internal static bool IsArrayTypeAssignableTo(Type type, Type target)
return false;
}

return type.GetArrayRank() == target.GetArrayRank() && type.GetElementType().IsAssignableToInternal(target.GetElementType());
return type.GetArrayRank() == target.GetArrayRank() && type.GetElementType().IsAssignableTo(target.GetElementType());
}

internal static bool IsArrayTypeAssignableToInterface(Type type, Type target)
Expand All @@ -233,21 +233,6 @@ internal static bool IsArrayTypeAssignableToInterface(Type type, Type target)
}

internal static bool IsAssignableTo(this Type type, Type target)
{
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}

if (target == null)
{
throw new ArgumentNullException(nameof(target));
}

return type.IsAssignableToInternal(target);
}

internal static bool IsAssignableToInternal(this Type type, Type target)
{
return target.IsAssignableFrom(type)
|| IsArrayTypeAssignableTo(type, target)
Expand Down

0 comments on commit 3bfc66d

Please sign in to comment.