Ejemplo n.º 1
0
        public override bool TryRead(ref ReadOnlySpan <byte> remaining, out T[] result, PropertyMap propMap = null)
        {
            if (EtfReader.TryReadNullSafe(ref remaining))
            {
                result = null;
                return(true);
            }

            if (!JsonCollectionReader.TryRead(_serializer, ref remaining, out result, propMap, _innerConverter, _pool, _serializer.Pool))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public override bool TryRead(ref ReadOnlySpan <byte> remaining, out List <T> result, PropertyMap propMap = null)
        {
            if (EtfReader.TryReadNullSafe(ref remaining))
            {
                result = null;
                return(true);
            }

            if (!JsonCollectionReader.TryRead(_serializer, ref remaining, out var resultArray, propMap, _innerConverter, _pool, _serializer.Pool))
            {
                result = default;
                return(false);
            }
            result = new List <T>(resultArray); // TODO: This is probably inefficient
            return(true);
        }