Calling a method from a different class that uses variables outside the method
问题 I have a problem. I have a method in a class like this: public void UpdateActionBar(int CurrentFragmentNum) { if (CurrentFragmentNum == 1) { btnBack.Visibility = ViewStates.Invisible; btnNext.Visibility = ViewStates.Invisible; } else { btnBack.Visibility = ViewStates.Visible; btnNext.Visibility = ViewStates.Visible; } if (CurrentFragmentNum == 3) { btnNext.Text = "Finish"; } else { btnNext.Text = "Next"; } } Now in another class I call this method like this: new ActionBar_Setup()