Why am I getting an error indicating that my variable doesn't exist, when I've already defined it?
问题 I get an error indicating that MyRandomArray doesn't exist in the current context. How do you access variables across classes in a C# WinForms application? public void Quiz_Load(object sender, EventArgs e) { string[] MyRandomArray = getWordList(); } private void timer1_Tick(object sender, EventArgs e) { somefunction(MyRandomArray);/// MyRandomArray doesn't exist in the current context. } 回答1: You've defined the array, but only in the scope of the Quiz_Load method, so the scope of timer1_Tick