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

New Post: class not defined error

$
0
0
Hello!

Unfortunately VBScript's New operator works only on VBScript classes. To instantiate a CLR class, you have to use HostFunctions.newObj:
engine.AddHostObject("host", new HostFunctions());
engine.AddHostType("Dictionary", typeof(Dictionary<string, object>));
engine.Execute(@"
    dict = host.newObj(Dictionary)
    dict.Add ""abc"", 123
");
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>