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

ReflectionExtensions

static class ReflectionExtensions
using System; using System.Linq; using System.Reflection; namespace NJsonSchema.Infrastructure { internal static class ReflectionExtensions { public static string GetTypeName(Type type) { if (type.IsConstructedGenericType) return type.get_Name().Split(new char[1] { '`' }).First() + "Of" + GetTypeName(type.GenericTypeArguments[0]); return type.get_Name(); } public static Type[] GetGenericTypeArguments(Type type) { Type[] genericTypeArguments = type.GenericTypeArguments; while ((object)type != null && (object)type != typeof(object) && genericTypeArguments.Length == 0) { type = type.GetTypeInfo().get_BaseType(); if ((object)type != null) genericTypeArguments = type.GenericTypeArguments; } return genericTypeArguments; } } }