Skip to content

CLR extension methods #1067

Answered by lahma
KoalaBear84 asked this question in Q&A
Discussion options

You must be logged in to vote

options.AddExtensionMethods(typeof(string)); does not make sense as String doesn't (cannot) contain any extension methods, they reside in static classes.

Your code should work if you write it as foo.Name.startsWith('B'), Jint matches using lower-case first letter by default to follow JS naming. You can override this via options.TypeResolver.MemberNameComparer configuration.

Best place to learn about extension methods is to read the related tests I guess.

Version 3 is available as beta builds from NuGet, don't know when it hits final stage.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by lahma
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1064 on January 27, 2022 10:37.