DotNext by Roman Sakno

<PackageReference Include="DotNext" Version="2.3.0" />

 TypeExtensions

public static class TypeExtensions
Various extension methods for type reflection.
public static object Cast(this Type type, object obj)

Casts an object to the class, value type or interface.

public static MethodInfo Devirtualize(this Type type, MethodInfo abstractMethod)

Returns method that overrides the specified method.

public static IEnumerable<Type> GetBaseTypes(this Type type, bool includeTopLevel = false, bool includeInterfaces = false)

Returns read-only collection of base types and, optionally, all implemented interfaces.

public static Type[] GetGenericArguments(this Type type, Type genericDefinition)

Returns actual generic arguments passed into generic type definition implemented by the input type.

public static bool IsAssignableFromWithoutBoxing(this Type to, Type from)

Indicates that object of one type can be implicitly converted into another without boxing.

public static bool IsGenericInstanceOf(this Type type, Type genericDefinition)

Determines whether the type is an instance of the specified generic type.

public static bool IsImmutable(this Type type)

Determines whether the type is read-only (immutable) value type.

public static bool IsUnmanaged(this Type type)

Determines whether the type is unmanaged value type.