[IronPython] Casting python list type to NET type

Filipe Silva filipejps at gmail.com
Fri May 25 01:26:54 CEST 2007


Hi all,

I've an VB.NET application invoking some python functions and I would
like these functions to return a list type.

I've already tried to cast the result from "list" (python) to
Collection (VB.NET), also to ArrayList and to a simple string array.
In all cases I receive a cast exception saying that it's not possible
to make that conversion...

Is there any NET type that could be directly casted from ironpython list type?

Note:
 1. I can return a String instead of a list, but I would need to parse
that string inside VB.NET (using some kind of token)

 2. I've found a solution by importing System.Collections.ArrayList in
my python script, then using ArrayList object instead of native list
type, however this way, my script doesn't work in a different engine
(that one in www.python.org, for instance)


Thanks,
Filipe



More information about the Ironpython-users mailing list