Skip to content

How to disable case insensitivity while using interop? #1783

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

You must be logged in to vote

Example of strict matching, you can write your own comparer to do strict first-lower.

[Fact]
public void CanConfigurePropertyNameMatcher()
{
// defaults
var e = new Engine();
e.SetValue("a", new A());
Assert.True(e.Evaluate("a.call1").IsObject());
Assert.True(e.Evaluate("a.Call1").IsObject());
Assert.True(e.Evaluate("a.CALL1").IsUndefined());
e = new Engine(options =>
{
options.SetTypeResolver(new TypeResolver
{
MemberNameComparer = StringComparer.Ordinal
});
});
e.SetValue("a", new A());
Assert.True(e.Evaluate("a.call1").

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by scarletquasar
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 #1782 on February 19, 2024 18:09.