Exemplo n.º 1
0
        /// <summary>
        /// Creates metadata for a primitive or a type with a custom converter.
        /// </summary>
        /// <typeparam name="T">The generic type definition.</typeparam>
        /// <returns>A <see cref="JsonTypeInfo{T}"/> instance representing the type.</returns>
        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called directly.</remarks>
        public static JsonTypeInfo <T> CreateValueInfo <T>(JsonSerializerOptions options, JsonConverter converter)
        {
            if (options is null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(options));
            }
            if (converter is null)
            {
                ThrowHelper.ThrowArgumentNullException(nameof(converter));
            }

            JsonTypeInfo <T> info = new SourceGenJsonTypeInfo <T>(converter, options);

            return(info);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates metadata for a primitive or a type with a custom converter.
        /// </summary>
        /// <typeparam name="T">The generic type definition.</typeparam>
        /// <returns>A <see cref="JsonTypeInfo{T}"/> instance representing the type.</returns>
        /// <remarks>This API is for use by the output of the System.Text.Json source generator and should not be called directly.</remarks>
        public static JsonTypeInfo <T> CreateValueInfo <T>(JsonSerializerOptions options, JsonConverter converter)
        {
            JsonTypeInfo <T> info = new SourceGenJsonTypeInfo <T>(converter, options);

            return(info);
        }