private static JsonConverter GetConverter(JsonSerializerOptions options) { DefaultJsonTypeInfoResolver.RootDefaultInstance(); return(GetEffectiveConverter( typeof(T), parentClassType: null, // A TypeInfo never has a "parent" class. memberInfo: null, // A TypeInfo never has a "parent" property. options)); }
internal static DefaultJsonTypeInfoResolver RootDefaultInstance() { if (s_defaultInstance is DefaultJsonTypeInfoResolver result) { return(result); } var newInstance = new DefaultJsonTypeInfoResolver(mutable: false); DefaultJsonTypeInfoResolver?originalInstance = Interlocked.CompareExchange(ref s_defaultInstance, newInstance, comparand: null); return(originalInstance ?? newInstance); }
public ModifierCollection(DefaultJsonTypeInfoResolver resolver) { _resolver = resolver; }