I am trying to write a function that allows passing different number of variables as references. I learned that we could use params modifier to achieve this. For example, I can declare my function as following:
void MyFunc(params object[] objs).
However, the variables will be passed in as values but what I really want is passing by references. I can get arround this by overloading MyFunc by incrementing the number of variables in the signature. For example:
MyFunc(ref object obj1)
MyFunc(ref object obj1, ref object obj2)
...and so on
but doing this is kind of annoying since I may need to pass in more or fewer variables later on.
Is there a generic way that we can pass different numbers of variables to a method in a simple way, like with the params modifier, by references
Thanks.
Tung.