Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Question about passing generic List.

$
0
0
Hi again,

It looks like that the C# class String is treated specially. Even with DisableTypeRestriction enabled, methods of String class, like EndsWith(), are not exposed to script interface. Is there a general way to enable such run-time type methods?

Strings and numbers are just about the only objects for which ClearScript performs automatic data conversion. For more information, see here.

Another similar issue I encountered is that when a C# method expects an argument, but when it is called in a script without argument, the script execution will fail with an exception. The old VSA JScript engine will call the method with default values (like null or 0). Is there a general property in ClearScript that enable such auto-argument-filling feature?

No, ClearScript does not support automatic argument filling, as its method binding algorithm is based on an analysis of the argument types. However, it does support default arguments, so if you're designing the API being exposed to the script engine, you can specify default arguments as necessary to provide similar flexibility.

Cheers!

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>