From out C# - MSDN
Although variables passed as out arguments do not have to be initialized before being passed, the called method is required to assign a value before the method returns.
Since a value must be assigned to the parameter with out
, you can't save the value in function. It would be better if you make a copy of the variable before calling the function. like:
int x = 1;
int backupX = x;
fun2(out x);