private IEnumerable <Expression> ParseFieldProviderParts(IFieldContext fieldContext, List <ParseFieldProviderExpressions> providerExpressionsList)
        {
            for (int i = 0; i < providerExpressionsList.Count; i++)
            {
                bool isLast = i == providerExpressionsList.Count - 1;
                ParseFieldProviderExpressions providerExpressions = providerExpressionsList[i];

                Expression test;

                Expression fitsLowerBound = Expression.LessThanOrEqual(
                    providerExpressions.StartingIndex,
                    Expression.Property(fieldContext.ParseFieldParams.OffsetRecord, _readRecordID));

                if (isLast)
                {
                    test = fitsLowerBound;
                }
                else
                {
                    Expression fitsUpperBound = Expression.LessThan(
                        Expression.Property(fieldContext.ParseFieldParams.OffsetRecord, _readRecordID),
                        providerExpressionsList[i + 1].StartingIndex);

                    test = Expression.And(fitsLowerBound, fitsUpperBound);
                }

                yield return
                    (Expression.IfThen(
                         test,
                         ParseFieldPart(fieldContext, providerExpressions)));
            }
        }
        private Expression ParseFieldExpression()
        {
            ParameterExpression key          = Expression.Parameter(typeof(int), "index");
            IFieldContext       fieldContext = new FieldContext(this, key);

            LabelTarget labelBreak = Expression.Label("_break");

            ParseFieldProviderExpressions providerExpressions = null;

            if (_providers.Count == 1)
            {
                IFieldProvider provider = _providers[0];
                providerExpressions = new ParseFieldProviderExpressions(provider, fieldContext);

                return(ParseFieldPart(fieldContext, providerExpressions));
            }
            else
            {
                List <ParseFieldProviderExpressions> providerExpressionsList = _providers
                                                                               .Select(p => new ParseFieldProviderExpressions(p, fieldContext))
                                                                               .ToList();

                IEnumerable <Expression> providerParseParts = ParseFieldProviderParts(fieldContext, providerExpressionsList);
                return(Expression.Block(providerParseParts.ToArray()));
            }
        }
        private Expression ParseFieldPart(IFieldContext fieldContext, ParseFieldProviderExpressions providerExpressions) => Expression.Block(
            new ParameterExpression[] { fieldContext.Key },

            Expression.Assign(
                fieldContext.Key,
                Expression.Subtract(
                    Expression.Property(ParseFieldParams.OffsetRecord, _readRecordID),
                    providerExpressions.StartingIndex)),

            Expression.Assign(
                Expression.Property(DeserializeParams.Stream, _streamPositionProperty),
                Expression.Property(ParseFieldParams.OffsetRecord, _readRecordOffset)),

            providerExpressions.DeserializeAndSaveFieldExpression);