I´m trying to create a new list from a flattened data tree of points using C# component

I can flatten the DataTree through “dTPoints.Flatten();” but the method is modifying the original one.
Tried List flatPoints = dTPoints.Flatten(), tried creating an empty list of points to add the flattened points but I´m getting error. 1. Error (CS0029): Cannot implicitly convert type ‘void’ to ‘System.Collections.Generic.List<Rhino.Geometry.Point3d>’
I need a new List. Thank you!

use AllData
if your component has
input ptsTree - set to Tree access, type hint Point3d
output A

A = ptsTree.AllData();

hope this helps - kind regards - tom

dataTree.AllData works for output (A = dataTree.AllData;). Flatten method doesn´t work here.

I just created a new flattened variable from my data (flattenedDT= new DataTree(dataTree);).
flattenedDT.Flatten works here, but flattenedDT.AllData does not. There is something happening there I don´t know or I´m missing. Anyway, thanks for the help @Tom_P

And in case that you want to monitor the origin: