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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }