fork download
  1. using static System.Console;
  2. using System.Collections.Generic;
  3.  
  4. public class Program {
  5. public static void Main() {
  6. var ints = new List<int> { 1, 2, 3 };
  7. var lists = new List<List<int>> { new List<int> { 1, 2, 3 }, new List<int> { 4, 5, 6 } };
  8. foreach (var item in ints) {
  9. // item = 9;
  10. }
  11. foreach (var item in lists) {
  12. item[0] = 9;
  13. }
  14. foreach (var item in lists) {
  15. // item = new List<int> { 7, 8, 9 };
  16. }
  17. foreach (var lista in lists) {
  18. foreach (var item in lista) {
  19. WriteLine(item);
  20. }
  21. }
  22. }
  23. }
  24.  
  25. //https://pt.stackoverflow.com/q/231849/101
Success #stdin #stdout 0.02s 16188KB
stdin
Standard input is empty
stdout
9
2
3
9
5
6