C# List Access - Output Size

Hi, long time lurker, first time poster.

I suspect this to be something really simple I just don’t know enough about list access…but when you’re in the C# component and you have to inputs of varied length, set to list access and as an example you ouput the length of one of the lists, I seem to be getting an list output, with the length of the first list as every value. I was expecting a single item output.
Here’s some images to show what I mean. (18 is the lenght of the list in x)

i have a horrible feeling there is a really obvious reason this happens, but if anyone would be kind enough to explain it I’d appreciate that.

First of all name your input params with proper names (like applesList, monkeysTree, bananaIndex etc etc). Other than that:

This happens when you input a flat collection (List) or a nested one (Tree). That said I do hope that you have FULLY master the DataTree thingy (if not take a break and go back to the future). That said the crap build in editor is broken with regard Lists (life sucks) - the equivalent of riding a sports bike with no front brakes.

Well let’s say that x in your C# is a List and you output in A the x.Count. So far so good.

But … IF y or z are NOT declared as Lists AND you input a List … this forces the C# to re-execute y/z.Count times … thus … blah, blah. This may appear an easy thing to fix … but if the C# is complex and the Elapsed time is, say, 200 milliseconds a simple mistake like that (i.e. a y with 1000 items [not declared as List], that is) can rocket time to Mars (and beyond)

Tip: ALWAYS post some stuff: an Image is nothing, a C# is something.

Yep. That’ll do it.
z (lets call it nodeCoordinates for the sake of having a decent name) is set as item access. Not calling it or using it in the code I wasn’t expecting it to have any impact but it’s doing exactly as you’ve said re-evaluating all the way to Mars.

Tips are always appreciated, especially for a first time post.

I’ll now retire to watch Back to the Future III (it’s underated).

1 Like

Not only that: few know that some De Lorean issues in the original movie occured due to wrong input in the year param (they used a big List instead of an integer > Armageddon) .

2 Likes