List in function argument

I’m curious about that: I’m passing a list (several hundred positions) containing many data per position (dataset is a struct with 7 variables) to a function as an argument. Is the incoming argument just a link to the source list or a copy, containing all the data independent of the source list?

Or are there even better ways to pass data to a function? Thanks.

Because you give a Generic List (probably) as a parameter, which is a class, you overgive the list as a reference - not a copy. Therefore, the structs saved in this lists don’t get copied (at least not inside the parameter).

If you use the structs later, you of cause copy them (e.g. DoSomething(MyList[0]) would copy the first element and send it as a parameter to “DoSomething()”)

If you want to use the structs as references (just like classes) without copying, you should use the ref-Keyword to pass the reference. That would be better if you use each struct inside your list to save loads of calculation/memory.