[Solved] How to assign a variable in one method and change/use it in another method? [closed]
[ad_1] You seem to have misunderstood how variable scopes work. The x in Assign is not the same as x in Main. This is because in C#, int is passed by value (this is the same as C++, BTW). You probably meant to mark the variables in Assign as ref: class Program { static void … Read more