5internal class ListDeserializer<T> : BaseDeserializer<List<T>>
7 private IDeserializer<T> _elemDeserializer;
9 public ListDeserializer(IDeserializer<T> elemDeserializer)
11 _elemDeserializer = elemDeserializer;
16 if (reader.CurrentTokenType !=
TokenType.StartArray)
17 throw new SerializationException(
18 $
"Unexpected token while deserializing into {typeof(List<T>)}: {reader.CurrentTokenType}");
20 var lst =
new List<T>();
21 while (reader.Read() && reader.CurrentTokenType !=
TokenType.EndArray)
23 lst.Add(_elemDeserializer.Deserialize(context, ref reader));
T Deserialize(MappingContext context, ref Utf8FaunaReader reader)
TokenType
Enumerates the types of tokens used in Fauna serialization.