summaryrefslogtreecommitdiff
path: root/mcs/errors/cs1654-5.cs
blob: fbabd02f1c8e15047ea486e15bd959b969dd37ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// CS1654: Cannot assign to members of `p' because it is a `foreach iteration variable'
// Line: 14

using System.Collections;

struct P {
	public int x { get; set; }
}

class Test {
	static void Foo (IEnumerable f)
	{
		foreach (P p in f)
			p.x += 2;
	}
}