예제 #1
0
        internal sealed override JsonConverter <TTarget> CreateCastingConverter <TTarget>()
        {
            if (this is JsonConverter <TTarget> conv)
            {
                return(conv);
            }

            JsonSerializerOptions.CheckConverterNullabilityIsSameAsPropertyType(this, typeof(TTarget));

            // Avoid layering casting converters by consulting any source converters directly.
            return
                (SourceConverterForCastingConverter?.CreateCastingConverter <TTarget>()
                 ?? new CastingConverter <TTarget, T>(this));
        }
예제 #2
0
 internal sealed override JsonConverter <TTarget> CreateCastingConverter <TTarget>()
 {
     JsonSerializerOptions.CheckConverterNullabilityIsSameAsPropertyType(this, typeof(TTarget));
     return(new CastingConverter <TTarget, T>(this));
 }