System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.Converters.cs (14)
15private static Dictionary<Type, JsonConverter>? s_defaultSimpleConverters;
41private static Dictionary<Type, JsonConverter> GetDefaultSimpleConverters()
44var converters = new Dictionary<Type, JsonConverter>(NumberOfSimpleConverters);
88void Add(JsonConverter converter) =>
94private static JsonConverter GetBuiltInConverter(Type typeToConvert)
99if (s_defaultSimpleConverters.TryGetValue(typeToConvert, out JsonConverter? converter))
120internal static bool TryGetDefaultSimpleConverter(Type typeToConvert, [NotNullWhen(true)] out JsonConverter? converter)
133private static JsonConverter? GetCustomConverterForMember(Type typeToConvert, MemberInfo memberInfo, JsonSerializerOptions options)
144internal static JsonConverter GetConverterForType(Type typeToConvert, JsonSerializerOptions options, bool resolveJsonConverterAttribute = true)
147JsonConverter? converter = options.GetConverterFromList(typeToConvert);
175private static JsonConverter GetConverterFromAttribute(JsonConverterAttribute converterAttribute, Type typeToConvert, MemberInfo? memberInfo, JsonSerializerOptions options)
177JsonConverter? converter;
193if (!typeof(JsonConverter).IsAssignableFrom(converterType) || ctor == null || !ctor.IsPublic)
198converter = (JsonConverter)Activator.CreateInstance(converterType)!;
System\Text\Json\Serialization\Metadata\JsonTypeInfo.cs (9)
42internal JsonTypeInfo(Type type, JsonConverter converter, JsonSerializerOptions options)
446/// Gets the <see cref="JsonConverter"/> associated with the current type.
449/// The <see cref="JsonConverter"/> associated with the type determines the value of <see cref="Kind"/>,
453public JsonConverter Converter { get; }
463/// The value of <see cref="Kind"/> is determined exclusively by the <see cref="JsonConverter"/>
914JsonConverter converter = DefaultJsonTypeInfoResolver.GetConverterForType(typeof(T), options, resolveJsonConverterAttribute: false);
955JsonConverter converter = DefaultJsonTypeInfoResolver.GetConverterForType(type, options, resolveJsonConverterAttribute: false);
961internal static JsonTypeInfo CreateJsonTypeInfo(Type type, JsonConverter converter, JsonSerializerOptions options)
975parameterTypes: [typeof(JsonConverter), typeof(JsonSerializerOptions)],