Grasshopper Component Input list

Hi,

I have a question about Grasshopper input parameters:
When I get one element I use:
bool GetData<T>(int index, ref T destination);
for trees:
bool GetDataTree<T>(int index, out GH_Structure<T> tree) where T : IGH_Goo;
for lists
bool GetDataList<T>(int index, List<T> list);

In the item case, element is passed as a reference, in the tree case as out.
What happens at the list case?

Can someone show me an example of a C# method how the GetDataList function is written?
I think I am missing some knowledge in basic function principles.
Because the return value is boolean, but somehow the list is passed without ref or out keywords.

No it’s me who didn’t know enough when I wrote that. In VB there is only ByRef, while out parameters must be handled via an attribute.

In the case of GetList(), the list must exist and in fact may already contain values. Any value retrieved from the input parameter will be appended to the list you provide.

2 Likes

Thank you for explanation.