/// <summary>
        /// Reads an as expression.
        /// </summary>
        /// <param name="leftHandSide">
        /// The expression on the left hand side of the operator.
        /// </param>
        /// <param name="previousPrecedence">
        /// The precedence of the expression just before this one.
        /// </param>
        /// <param name="parentReference">
        /// The parent code unit.
        /// </param>
        /// <param name="unsafeCode">
        /// Indicates whether the code being parsed resides in an unsafe code block.
        /// </param>
        /// <returns>
        /// Returns the expression.
        /// </returns>
        private AsExpression GetAsExpression(Expression leftHandSide, ExpressionPrecedence previousPrecedence, Reference<ICodePart> parentReference, bool unsafeCode)
        {
            Param.AssertNotNull(leftHandSide, "leftHandSide");
            Param.Ignore(previousPrecedence);
            Param.AssertNotNull(parentReference, "parentReference");
            Param.Ignore(unsafeCode);

            AsExpression expression = null;

            // Check the previous precedence to see if we are allowed to gather up the as expression.
            if (CheckPrecedence(previousPrecedence, ExpressionPrecedence.Relational))
            {
                Reference<ICodePart> expressionReference = new Reference<ICodePart>();

                // Make sure the left hand side has at least one token.
                Debug.Assert(leftHandSide.Tokens.First != null, "The left hand side should not be empty");

                // Get the as symbol.
                this.tokens.Add(this.GetToken(CsTokenType.As, SymbolType.As, parentReference, expressionReference));

                // The next token must be the type.
                this.GetNextSymbol(SymbolType.Other, expressionReference);

                // Get the expression representing the type.
                LiteralExpression rightHandSide = this.GetTypeTokenExpression(expressionReference, unsafeCode, true);
                if (rightHandSide == null || rightHandSide.Tokens.First == null)
                {
                    throw this.CreateSyntaxException();
                }

                // Create the partial token list for the expression.
                CsTokenList partialTokens = new CsTokenList(this.tokens, leftHandSide.Tokens.First, this.tokens.Last);

                // Create and return the expression.
                expression = new AsExpression(partialTokens, leftHandSide, rightHandSide);
                expressionReference.Target = expression;
            }

            return expression;
        }
 /// <summary>
 /// The save.
 /// </summary>
 /// <param name="asExpression">
 /// The as expression.
 /// </param>
 private void Save(AsExpression asExpression)
 {
     this.cppWriter.Write("dynamic_cast<");
     this.Save(asExpression.Type, this.cppWriter, SavingOptions.None);
     this.cppWriter.Write(">(");
     @switch(asExpression.Value);
     this.cppWriter.Write(")");
 }