public static Type GetUnderlyingType()

in src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/TypeExtensions.cs [454:478]


        public static Type GetUnderlyingType(this Type type)
        {
            var underlyingType = default(Type);
            if (type.IsOpenApiNullable(out var nullableUnderlyingType))
            {
                underlyingType = nullableUnderlyingType;
            }

            if (type.IsOpenApiArray())
            {
                underlyingType = type.GetElementType() ?? type.GetGenericArguments()[0];
            }

            if (type.IsOpenApiDictionary())
            {
                underlyingType = type.GetGenericArguments()[1];
            }

            if (underlyingType.IsOpenApiNullable(out var nullableUnderlyingTypeOfUnderlyingType))
            {
                underlyingType = nullableUnderlyingTypeOfUnderlyingType;
            }

            return underlyingType;
        }