-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to extend Enumerable (IEnumerable?) #99
Comments
You can add stuff to the Enumerable prototype, I don't see why not. You can check the code to see how other prototype methods are implemented: Line 2097 in 45a45fb
|
@mihaifm Custom prototype functions can be added properly into a js file, just like you said.
Do you know how to achieve that? |
Forgot to comment, but yeah... same problem I'm having :D |
@juancri I found a workaround and it also works for linq.js with ts. To my understanding, the reason why we cannot extend linq.js with ts directly is that the namespace Line 237 in 45a45fb
@mihaifm So is it possible to add |
I'm extending
Array<T>
using this technique.A silly example:
Is there any recommended way to do the same with Enumerable / IEnumerable?
I think the challenge here is to extend the interface, which is the return type of Enumerable methods.
Part 2: Include non-standard methods
If extension is not possible, what about adding non-standard LINQ methods to the library? I'm thinking about methods like
takeUntilIncluding
, which includes the first item that matches the predicate as well (example).The text was updated successfully, but these errors were encountered: