I would like to have a function that modifies a list of variables, but all types of values (int, string). Is there a way to get the params keyword to work with the ref keyword or something close to that?
public void funcParams(params object[] list) { } public void testParams() { int a = 1, b = 2, c = 3; funcParams(a, b, c); }
The problem is that I am trying to simplify my life by creating a method that changes the fields of an object. I am doing dynamic code generation with Cecil, and I try to avoid writing too much code generated by IL.
To simplify, I would like to pass the list of fields by reference, I need to go to a function that changes them, rather than changing them, generating the corresponding IL. Some of the parameters are nullable and make code generation a bit more painful. In this case, using some overload methods instead of parameters will not be very useful.
source share