How to override delete operator in JS from C#. #1426
-
Hello, I'm trying to create an automated script and i will expose an disposable class to JS. There's an way to proper call |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think that would be a bit leaky abstraction, Maybe you could have a helper function that wraps try-finally and Dispose following the actual semantics that .NET CLR/compiler does, something like: function usingDisposable(target, action) {
try {
action(target);
}
finally {
target.dispose();
}
} |
Beta Was this translation helpful? Give feedback.
I think that would be a bit leaky abstraction,
delete
and and Dispose pattern don't map that well together. The explicit resource management proposal would be something that would naturally map to .NET side.Maybe you could have a helper function that wraps try-finally and Dispose following the actual semantics that .NET CLR/compiler does, something like: