[Mono-dev] foreach and structs. Possible bug on mcs?

Pablo Iñigo Blasco pibgeus at gmail.com
Thu Dec 1 17:33:27 EST 2005


hello. mcs lets me use structs as iteration variable in a foreach loop, csc
does not.

using System.Drawing;
            ...
Point[] puntos=new Point[64];
System.Random r=new Random();
foreach(Point p in puntos)
{
p.X=r.Next(this.Width);//A
p.Y=r.Next(this.Height);//B
}
          ...

- compiles ok for mcs.
- two compilation erros on csc, lines A and B: Cannot modify members of 'p'
because it is a 'foreach iteration variable'

mcs version: 1.1.10.0
csc version: 1.1.4322

bye.
--
No hay viento favorable para el que no sabe donde va.
Pablo Iñigo Blasco - GeuS- www.geus.es.vg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20051201/3af4d5b3/attachment.html 


More information about the Mono-devel-list mailing list