Closed Tor012 closed 1 year ago
Hi @Tor012,
In C#, the unqualified identifier CarSpecs
can refer to both a type and an object; the compiler resolves the ambiguity based on the identifier's syntactic context. In VBScript, however, both the property and the host type are objects, and a single identifier can't refer to more than one object.
One thing you could do is expose the host type under a different name:
engine.AddHostType("CarSpecsT", typeof(CarSpecs));
engine.AddHostObject("car", HostItemFlags.GlobalMembers, vCar);
Console.WriteLine(engine.Evaluate("car.CarSpecs.CarType Is CarSpecsT.enCarType.Cabrio"));
Console.WriteLine(engine.Evaluate("CarSpecs.CarType Is CarSpecsT.enCarType.Cabrio"));
Good luck!
Please reopen this issue if you have additional thoughts or questions about this topic. Thank you!
Hello, is it possible to use "global members" if member and type have the same name?
Sample code here