Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
FSharpMapConverter.cs
Go to the documentation of this file.
4
6
7internal sealed class FSharpMapConverter<TMap, TKey, TValue> : DictionaryDefaultConverter<TMap, TKey, TValue> where TMap : IEnumerable<KeyValuePair<TKey, TValue>>
8{
10
11 internal override bool CanHaveIdMetadata => false;
12
13 [RequiresUnreferencedCode("Uses Reflection to access FSharp.Core components at runtime.")]
15 {
16 _mapConstructor = FSharpCoreReflectionProxy.Instance.CreateFSharpMapConstructor<TMap, TKey, TValue>();
17 }
18
19 protected override void Add(TKey key, in TValue value, JsonSerializerOptions options, ref ReadStack state)
20 {
21 ((List<Tuple<TKey, TValue>>)state.Current.ReturnValue).Add(new Tuple<TKey, TValue>(key, value));
22 }
23
28
33}
void Add(TKey key, TValue value)
readonly Func< IEnumerable< Tuple< TKey, TValue > >, TMap > _mapConstructor
override void ConvertCollection(ref ReadStack state, JsonSerializerOptions options)
override void Add(TKey key, in TValue value, JsonSerializerOptions options, ref ReadStack state)
override void CreateCollection(ref Utf8JsonReader reader, ref ReadStack state)