コード例 #1
0
 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));
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 public ModifierCollection(DefaultJsonTypeInfoResolver resolver)
 {
     _resolver = resolver;
 }