diff --git a/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/AbstractConverter.cs b/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/AbstractConverter.cs
index a63f2bd2704562f4a4b62396a9572d1a260a1b6f..faebb26eed2fbcbde840a020bd189ca87c28870b 100644
--- a/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/AbstractConverter.cs
+++ b/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/AbstractConverter.cs
@@ -128,7 +128,7 @@ private static QueryClauseSyntax CreateQueryClause(ExtendedSyntaxNode node)
{
var foreachStatement = ForEachInfo.ForEachStatement;
selectExpression = selectExpression.WithCommentsFrom(leadingTokensForSelect, ForEachInfo.TrailingTokens.Concat(trailingTokensForSelect));
- int currentExtendedNodeIndex = 0;
+ var currentExtendedNodeIndex = 0;
return CreateLinqInvocation(
foreachStatement,
@@ -162,7 +162,7 @@ private static QueryClauseSyntax CreateQueryClause(ExtendedSyntaxNode node)
// OUTPUT:
// c1.SelectMany(n1 => c2.Where(n2 => n1 > n2).Select(n2 => n1 + n2))
//
- bool hasForEachChild = false;
+ var hasForEachChild = false;
var lambdaBody = CreateLinqInvocationForExtendedNode(selectExpression, ref currentExtendedNodeIndex, ref receiverForInvocation, ref hasForEachChild);
var lambda = SyntaxFactory.SimpleLambdaExpression(
SyntaxFactory.Parameter(
@@ -194,6 +194,14 @@ private static QueryClauseSyntax CreateQueryClause(ExtendedSyntaxNode node)
SyntaxFactory.Argument(lambda))));
}
+ ///
+ /// Creates a linq invocation expression for the node at the given index
+ /// or returns the if all extended nodes have been processed.
+ ///
+ /// Innermost select expression
+ /// Index into to be processed and updated.
+ /// Receiver for the generated linq invocation. Updated when processing an if statement.
+ /// Flag indicating if any of the processed is a .
private ExpressionSyntax CreateLinqInvocationForExtendedNode(
ExpressionSyntax selectExpression,
ref int extendedNodeIndex,