[Mono-dev] foreach and structs. Possible bug on mcs?
Miguel de Icaza
miguel at ximian.com
Fri Dec 2 01:11:23 EST 2005
Hello,
> hello. mcs lets me use structs as iteration variable in a foreach
> loop, csc does not.
Looks like a bug, please file it on:
www.mono-project.com/Bugs
> 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
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
--
Miguel de Icaza <miguel at ximian.com>
More information about the Mono-devel-list
mailing list