C# call for 'Member Of'?

I’m trying to use C# to find the list index where the item contains a string of text.
I have been able to do it using text match and member of index as well as using for C# for loop, but I feel both are clunky in their operation.


list_item.gh (7.2 KB)

Hi,

no, there is nothing wrong with using the Contains() method. I use it quite often. Alternatively, you can use,
“IndexOf” or Regex. You can also use the LINQ extension to filter a collection (“Where”, “Select”, “Any” …).
But this all depends on the use-case, and I do not quite understand what you are trying to achieve…

I just feel like my approach is just a hack, I first tried the indexOf, but was getting a bit lost. Do you mind showing an example of how to use indexOf?