Greetings!
The
The
Another thing you can do is use a .NET enumerator:
Good luck!
The
List
class has an indexed property named "Item". This property is exposed as a C# indexer, but you can use it from script in its true form:engine.AddHostObject("list", new List<string> { "abc", "def", "ghi", "jkl" }); engine.AddHostType("Console", typeof(Console)); engine.Execute(@" for i = 0 to list.Count - 1 Console.WriteLine list.Item(i) next ");
ElementAt
method is a LINQ extension. To use it, you must expose LINQ's Enumerable
class:engine.AddHostType("Enumerable", typeof(Enumerable)); engine.Execute(@" for i = 0 to list.Count - 1 Console.WriteLine list.ElementAt(i) next ");
engine.Execute(@"
e = list.GetEnumerator()
while e.MoveNext()
Console.WriteLine e.Current
wend
");