How to obtain a System.Type object in JScript.NET?

440 views Asked by At

There is an old .ASPX page using "javascript" (JScript) as the page language.

And there is a C# method in a referenced assembly that should be invoked.

public void IX Locate(Type x)

Using C# this method can be invoked by supplying the corresponding Type object.

var o = locator.Locate(typeof(XImpl));

However, in JScript typeof operator always returns string instead of a desired Type object.

  • How is it possible to obtain the System.Type object in JScript (and invoke this method)?

I've been looking around the dated/introductory JScript documentation and have been unable to find a stuiable operator or method.


Edit: It is possible to use Type.GetType(name) or similar. However this requires manually resolving the type name instead of having the compiler do the work. This also requires having the assembly name.

0

There are 0 answers