// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Concurrent; using System.Diagnostics.CodeAnalysis; namespace System.Text.Json.Serialization.Converters { internal sealed class ConcurrentQueueOfTConverter<TCollection, TElement> : IEnumerableDefaultConverter<TCollection, TElement> where TCollection : ConcurrentQueue<TElement> { internal override bool CanPopulate => true; protected override void Add(in TElement value, ref ReadStack state) { ((TCollection)state.Current.ReturnValue!).Enqueue(value); } } } |