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 IEnumerable CreateFromList(ref ReadStack state, IList sourceList, JsonSerializerOptions options) { Type immutableCollectionType = state.Current.JsonPropertyInfo.RuntimePropertyType; JsonClassInfo elementClassInfo = state.Current.JsonPropertyInfo.ElementClassInfo; Type elementType = elementClassInfo.Type; string delegateKey = GetDelegateKey(immutableCollectionType, elementType, out _, out _); JsonPropertyInfo propertyInfo = elementClassInfo.PolicyProperty ?? elementClassInfo.CreateRootProperty(options); Debug.Assert(propertyInfo != null); return(propertyInfo.CreateImmutableCollectionInstance(ref state, immutableCollectionType, delegateKey, sourceList, options)); }