-
Hi, I've tried to use TypeReference.CreateTypeReference to define the class in js for my c# class.
The problem is that if I created a instance of MyClass in javascript,
It always return '[object Object]' I tried to define the toStringTag in js, it works as expected.
But how could I do the same thing for the class defined in c#?
Thanks a lot for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Jint seems to have some trouble understanding the reading of property from wrapped object's type reference. You can work around it by having a custom object wrapper logic at least. var engine = new Engine(options => options.SetWrapObjectHandler((e, target, t) =>
{
var wrapper = new ObjectWrapper(e, target, t);
wrapper.FastSetProperty(GlobalSymbolRegistry.ToStringTag, new PropertyDescriptor(target.GetType().Name, false, false, true));
return wrapper;
})); |
Beta Was this translation helpful? Give feedback.
Jint seems to have some trouble understanding the reading of property from wrapped object's type reference. You can work around it by having a custom object wrapper logic at least.