Exemplo n.º 1
0
        public override IEnumerable CreateFromList(ref ReadStack state, IList sourceList, JsonSerializerOptions options)
        {
            JsonPropertyInfo collectionPropertyInfo = state.Current.JsonPropertyInfo;
            JsonPropertyInfo elementPropertyInfo    = options.GetJsonPropertyInfoFromClassInfo(collectionPropertyInfo.ElementType, options);

            return(elementPropertyInfo.CreateDerivedEnumerableInstance(ref state, collectionPropertyInfo, sourceList));
        }
Exemplo n.º 2
0
        public override object CreateFromDictionary(ref ReadStack state, IDictionary sourceDictionary, JsonSerializerOptions options)
        {
            JsonPropertyInfo collectionPropertyInfo = state.Current.JsonPropertyInfo;
            JsonPropertyInfo elementPropertyInfo    = options.GetJsonPropertyInfoFromClassInfo(collectionPropertyInfo.ElementType, options);

            return(elementPropertyInfo.CreateDerivedDictionaryInstance(collectionPropertyInfo, sourceDictionary, state.JsonPath, options));
        }
Exemplo n.º 3
0
        public override IEnumerable CreateFromList(ref ReadStack state, IList sourceList, JsonSerializerOptions options)
        {
            Type             enumerableType = state.Current.JsonPropertyInfo.RuntimePropertyType;
            Type             elementType    = state.Current.JsonPropertyInfo.ElementType;
            JsonPropertyInfo propertyInfo   = options.GetJsonPropertyInfoFromClassInfo(elementType, options);

            return(propertyInfo.CreateIEnumerableInstance(enumerableType, sourceList, state.JsonPath, options));
        }
Exemplo n.º 4
0
        public override object CreateFromDictionary(ref ReadStack state, IDictionary sourceDictionary, JsonSerializerOptions options)
        {
            Type             dictionaryType   = state.Current.JsonPropertyInfo.RuntimePropertyType;
            JsonClassInfo    elementClassInfo = state.Current.JsonPropertyInfo.ElementClassInfo;
            JsonPropertyInfo propertyInfo     = options.GetJsonPropertyInfoFromClassInfo(elementClassInfo, options);

            return(propertyInfo.CreateIDictionaryInstance(dictionaryType, sourceDictionary, state.JsonPath, options));
        }
Exemplo n.º 5
0
        public override IEnumerable CreateFromList(ref ReadStack state, IList sourceList, JsonSerializerOptions options)
        {
            Type immutableCollectionType = state.Current.JsonPropertyInfo.RuntimePropertyType;
            Type elementType             = state.Current.GetElementType();

            string delegateKey = GetDelegateKey(immutableCollectionType, elementType, out _, out _);

            JsonPropertyInfo propertyInfo = options.GetJsonPropertyInfoFromClassInfo(elementType, options);

            return(propertyInfo.CreateImmutableCollectionInstance(immutableCollectionType, delegateKey, sourceList, state.JsonPath, options));
        }
Exemplo n.º 6
0
        public override object CreateFromDictionary(ref ReadStack state, IDictionary sourceDictionary, JsonSerializerOptions options)
        {
            Type immutableCollectionType = state.Current.JsonPropertyInfo.RuntimePropertyType;
            Type elementType             = state.Current.GetElementType();

            string delegateKey = DefaultImmutableEnumerableConverter.GetDelegateKey(immutableCollectionType, elementType, out _, out _);

            JsonPropertyInfo propertyInfo = options.GetJsonPropertyInfoFromClassInfo(elementType, options);

            return(propertyInfo.CreateImmutableDictionaryInstance(ref state, immutableCollectionType, delegateKey, sourceDictionary, options));
        }
Exemplo n.º 7
0
        internal IDictionary CreateFromDictionary(ref ReadStack state, IDictionary sourceDictionary, JsonSerializerOptions options)
        {
            Type immutableCollectionType = state.Current.JsonPropertyInfo.RuntimePropertyType;
            Type elementType             = state.Current.GetElementType();

            string delegateKey = GetDelegateKey(immutableCollectionType, elementType, out _, out _);

            Debug.Assert(s_createRangeDelegates.ContainsKey(delegateKey));

            JsonClassInfo    elementClassInfo = state.Current.JsonPropertyInfo.ElementClassInfo;
            JsonPropertyInfo propertyInfo     = options.GetJsonPropertyInfoFromClassInfo(elementClassInfo, options);

            return(propertyInfo.CreateImmutableCollectionFromDictionary(immutableCollectionType, delegateKey, sourceDictionary, state.JsonPath));
        }