The standard way to do this exact behavior in C # 3 and earlier is to overload the method in question:
public void myMethod(int i, MyClass obj, int value=100){
And if MyClass is a reference type, then obj will be a reference to the MyClass object. adding the ref keyword will make obj link (as before) passed by reference . In other words, you could do:
obj = new MyClass();
... and you must change the link that was passed to myMethod . Otherwise (without ref ) you will only change the local link; and the original link, no matter what was transferred to myMethod , will remain unchanged.
source share