using System;
using System.Drawing ;
using System.Collections .Generic ;
public class Test
{
public static void Main( ) {
var list = new List< Point> ( ) ;
list.Add ( new Point( 10 , 20 ) ) ;
list.Add ( new Point( 20 , 40 ) ) ;
list.Add ( new Point( 40 , 80 ) ) ;
list[ 1 ] .X = 30 ;
foreach( var pt in list) {
Console.WriteLine ( pt) ;
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uRHJhd2luZzsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7CgpwdWJsaWMgY2xhc3MgVGVzdAp7CglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpIHsKCQl2YXIgbGlzdCA9IG5ldyBMaXN0PFBvaW50PigpOwoJCWxpc3QuQWRkKG5ldyBQb2ludCgxMCwgMjApKTsKCQlsaXN0LkFkZChuZXcgUG9pbnQoMjAsIDQwKSk7CgkJbGlzdC5BZGQobmV3IFBvaW50KDQwLCA4MCkpOwoJCQoJCWxpc3RbMV0uWCA9IDMwOwoJCQoJCWZvcmVhY2godmFyIHB0IGluIGxpc3QpIHsKCQkJQ29uc29sZS5Xcml0ZUxpbmUocHQpOwoJCX0KCQkJCgl9Cn0=
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