Hi JC,
ClearScript converts strings automatically, so if the script function returns a string, the host should see it as a .NET string, and casting via
Regarding, your second question, please see here. Edit: In VB.NET, the extension class might look something like this:
Cheers!
ClearScript converts strings automatically, so if the script function returns a string, the host should see it as a .NET string, and casting via
CStr()
or CType()
should work. It appears instead that your return value is a script object. Can you check (or share) the getChunkJSON()
source code?Regarding, your second question, please see here. Edit: In VB.NET, the extension class might look something like this:
Imports System.Dynamic Imports Microsoft.ClearScript Module ScriptEngineExtensions <System.Runtime.CompilerServices.Extension> PublicFunction InvokeFunction(engine As ScriptEngine, name AsString, args() AsObject) Dim host AsNew HostFunctions CType(host, IScriptableObject).OnExposedToScriptCode(engine) Dim func = host.getProperty(CType(engine.Script, IDynamicMetaObjectProvider), name) Dim del = CType(host.func(Of Object)(args.Length, func), System.Delegate) InvokeFunction = del.DynamicInvoke(args) EndFunctionEndModule