Hi,
Suppose you want to use .NET's Dictionary generic type. The first step is to expose the generic type itself:
Next, expose any additional types you need to create the required specific dictionary type. For example:
Now you can instantiate your specific type from VBScript code:
Note that it's easier and often sufficient to simply expose the specific type instead:
Good luck!
Suppose you want to use .NET's Dictionary generic type. The first step is to expose the generic type itself:
engine.AddHostType("Dictionary", typeof(Dictionary<,>));
engine.AddHostType("DayOfWeek", typeof(DayOfWeek)); engine.AddHostType("Int32", typeof(int));
engine.AddHostObject("host", new HostFunctions()); engine.Execute(@" dict = host.newObj(Dictionary(DayOfWeek, Int32)) dict.Add DayOfWeek.Monday, 123 ");
engine.AddHostType("StringDictionary", typeof(Dictionary<string, object>)); engine.Execute(@" dict = host.newObj(StringDictionary) dict.Add ""abc"", 123 ");