mgusmano / sharpkit

Automatically exported from code.google.com/p/sharpkit
0 stars 0 forks source link

add foreach support for typed arrays #316

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
NA

Original issue reported on code.google.com by DanelK...@gmail.com on 12 Sep 2013 at 3:25

GoogleCodeExporter commented 8 years ago
Can you give me an example, where it will not work?

This works:
            int[] bla = new int[] { 1, 2, 3 };
            foreach (var v in bla){};

js:

    var bla = new Int32Array([1, 2, 3]);
    for (var $i2 = 0, $l2 = bla.length, v = bla[$i2]; $i2 < $l2; $i2++, v = bla[$i2])
    {
    }

Original comment by sebastia...@gmail.com on 4 Nov 2013 at 5:07

GoogleCodeExporter commented 8 years ago
It will not work if the object is casted to IEnumerable in clr mode. Then the 
generated code will look for GetEnumerator() method that doesn't exist.

Original comment by DanelK...@gmail.com on 5 Nov 2013 at 2:27