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

New Post: Type argument : how to make a typeof

$
0
0
Hi Sybaris,

ClearScript's HostFunctions class provides a number of utility methods for situations like this, including typeOf(). The only other thing to be aware of is that ClearScript blocks reflection by default, but you can easily enable it:
scriptEngine.AddHostObject("host", new HostFunctions());
scriptEngine.AllowReflection = true;
scriptEngine.Execute(@"
    var dt = new DotNet.System.Data.DataTable('testDataTable');
    dt.Columns.Add('Col1', host.typeOf(DotNet.System.Int32));
");
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>