Skip to content

Adding getters to .NET types #398

Discussion options

You must be logged in to vote

Hi @AudriusButkevicius,

The .NET and JavaScript type systems are radically different. Interception allows ClearScript to create JavaScript proxies to .NET resources, but these proxies don't follow JavaScript's prototypal inheritance conventions, which simply don't map well to .NET's type system.

However, if you're in control of the objects and types you're exposing, you can use .NET's flexibility to emulate aspects of JavaScript's model.

Conceptually, the prototype is similar to a static property, so the key is to define such a property in your classes and allow instances to dynamically "inherit" properties from the prototype.

One complication here is that any script object you hang on th…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@AudriusButkevicius
Comment options

@ClearScriptLib
Comment options

@AudriusButkevicius
Comment options

Answer selected by AudriusButkevicius
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