/// <summary> /// Process for each variable declaration. /// </summary> /// <param name="foreachVariableDeclaration"> /// The for each variable declaration. /// </param> private static void ProcessForeachVariableDeclaration(IForeachVariableDeclaration foreachVariableDeclaration) { ILocalVariable variable = foreachVariableDeclaration.DeclaredElement; if (variable != null) { if (!foreachVariableDeclaration.IsVar) { using (WriteLockCookie.Create(true)) { foreachVariableDeclaration.SetType(variable.Type); } } } }