On Mon, Oct 11, 2010 at 11:40 AM, Mark Senko <mse...@completegenomics.com> wrote: > But I’ve had an impossible time trying to figure out how to iterate over an > IronPython.Runtime.List as returned by a command such as dir() since it > seems to not be enumerable. > > Typecasting this object doesn’t to an array or a List<> doesn’t seem to > work.
Have you tried casting to IEnumerable? That has always* worked for me. var _pythonRes = source.Execute(_pscope); if(_pythonRes is IEnumerable) { ... } Or, in C# 4, you should be able to make _pythonRes dynamic: dynamic _pythonRes = source.Execute(_pscope); foreach(dynamic r in _pythonRes) { ... } Whichever works better for you. - Jeff * There used to be some bugs, but they should be long gone. _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com