<PackageReference Include="System.Text.Json" Version="7.0.0" />

ConcurrentStackOfTConverter<TCollection, TElement>

sealed class ConcurrentStackOfTConverter<TCollection, TElement> : IEnumerableDefaultConverter<TCollection, TElement> where TCollection : ConcurrentStack<TElement>
using System.Collections.Concurrent; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace System.Text.Json.Serialization.Converters { internal sealed class ConcurrentStackOfTConverter<TCollection, TElement> : IEnumerableDefaultConverter<TCollection, TElement> where TCollection : ConcurrentStack<TElement> { protected override void Add([In] [IsReadOnly] TElement value, ref ReadStack state) { ((TCollection)state.Current.ReturnValue).Push(value); } } }