public static void InvokeTest(Action<string> WriteLine) { var Enumerable_Range_1_2 = new[] { 1, 2 }.AsEnumerable(); var Enumerable_Range_3_2 = new[] { 3, 4 }.AsEnumerable(); foreach (var item in Enumerable_Range_1_2 .SelectMany( x => { WriteLine("SelectMany " + new { x }); return Enumerable_Range_3_2.Select( y => { WriteLine("Select " + new { x, y }); return new { x, y }; } ); } ) // jsc should call it automatically to allow arrays .AsEnumerable() ) { WriteLine(item.ToString()); } }