fork(1) download
  1. using System;
  2. using System.Drawing;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7. public static void Main() {
  8. var list = new List<Point>();
  9. list.Add(new Point(10, 20));
  10. list.Add(new Point(20, 40));
  11. list.Add(new Point(40, 80));
  12.  
  13. list[1].X = 30;
  14.  
  15. foreach(var pt in list) {
  16. Console.WriteLine(pt);
  17. }
  18.  
  19. }
  20. }
Compilation error #stdin compilation error #stdout 0.03s 24256KB
stdin
1
2
10
42
11
compilation info
prog.cs(13,11): error CS1612: Cannot modify a value type return value of `System.Collections.Generic.List<System.Drawing.Point>.this[int]'. Consider storing the value in a temporary variable
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty