Replies: 1 comment
-
Sounds like a logical addition to interop, would you like to create a PR with associated test case? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In C#, when your write an enumerator like so :
the finally section is always executed, even if the calling code aborts the iteration by throwing exceptions. This is particularly convenient, because an iterator can be used to open a disposable resource, iterate upon it, and then be assured that the resource will always be correctly disposed.
However, when the iterator is exposed to a Jint script, this pattern does not work. The following script does not trigger the execution of the finally part :
A possible simple extension could be to override the Close method in EnumerableIterator:
Beta Was this translation helpful? Give feedback.
All reactions