Converting IronPython.Runtime.List to List<Curve> in C#

Hey everyone, is there any way that I can convert IronPython.Runtime.List to List in C#? Appreciation in advance :slight_smile:

Hi @Tommy70101, try to cast the output object to IList<object> first, and then you can use OfType() to convert the type.

var cList = cells as IList<object>;
var curves = cList.OfType<Curve>().ToList();
A = curves;
1 Like

Or use ghpythonlib.treehelpers to convert your Python lists to data trees.

See for instance the following post as example

Thanks a lot, Mingbo. It works! of course using System.Linq is needed

Thanks, Nathan. This post is very useful!