If you explicitly implement IEnumerable<T> e.g.
[JsType(JsMode.Clr, Filename = "res/Tester.js")]
public class Points : IEnumerable<int>
{
IEnumerator<int> IEnumerable<int>.GetEnumerator()
{
yield return 1;
}
IEnumerator IEnumerable.GetEnumerator()
{
yield return 1;
}
}
Then attempt to foreach over it
[JsType(JsMode.Clr, Filename = "res/Tester.js")]
public class Tester
{
public static void TestEnumerating()
{
var points = new Points();
foreach (var point in points)
{
new jQuery(HtmlContext.document.body).append("Point:" + point);
}
}
}
It will fail at runtime with:
Uncaught TypeError: Object [object Object] has no method 'GetEnumerator'
Tester.js:29
SharpKitWebApp4$Tester.staticDefinition.TestEnumerating Tester.js:29
btnTest_click Default.js:9
onclick
Using SharpKit 5.2.8
This may related to
https://code.google.com/p/sharpkit/issues/detail?id=71
Original issue reported on code.google.com by co...@gravill.com on 4 Dec 2013 at 2:25
Original issue reported on code.google.com by
co...@gravill.com
on 4 Dec 2013 at 2:25