<PackageReference Include="NJsonSchema" Version="9.9.3" />

ReflectionExtensions

public static class ReflectionExtensions
Provides extension methods for reflection.
public static Type FindCommonBaseType(this IEnumerable<Type> types)

Finds the first common base of the given types.

public static Type GetEnumerableItemType(this Type type)

Gets the type of the array item.

public static Type[] GetGenericTypeArguments(this Type type)

Gets the generic type arguments of a type.

public static bool HasProperty(this object obj, string propertyName)

Determines whether the specified property name exists.

public static bool InheritsFrom(this Type type, string typeName, TypeNameStyle typeNameStyle)

Checks whether the given type inherits from the given type name.

public static bool IsAssignableTo(this Type type, string typeName, TypeNameStyle typeNameStyle)

Checks whether the given type is assignable to the given type name.

public static T TryGetByObjectType<T>(this IEnumerable<T> attributes, string typeName, TypeNameStyle typeNameStyle = 1)

Tries to get the first object of the given type name.

public static T TryGetIfAssignableTo<T>(this IEnumerable<T> attributes, string typeName, TypeNameStyle typeNameStyle = 1)

Tries to get the first object which is assignable to the given type name.

public static T TryGetPropertyValue<T>(this object obj, string propertyName, T defaultValue = null)

Determines whether the specified property name exists.