Dear @Olivia9
in which context do you use this function / search-result / data ?
There is different kinds of collections in c# and additional possibilities in Rhinocommon and Grasshopper API.
one dimensional or multi-dimensional Arrays.
Lists, or Lists of Lists
Dictionary, or a Dictionary containing lists
…
It really depends on where you use the result of the function.
The member Index component is doing something similar to multiple calls of
(this can also be achieved with linq)
Creating a list of all indices and returns this list and it s length.
Data Tree
Depending on what you re doing - additionally to approaches posted above - you might profit from using datatrees inside your c# component:
this topic also shows a simple example how to create a datatree
hope this helps - kind regards -tom