看板 C_Sharp 關於我們 聯絡資訊
不好意思 我想在程式中改變參考的物件 應該怎麼做? 下面的code在執行時會出現"並未將物件參考設定為物件的執行個體" private char[] tempStudentAns; private string[] noAns; private char[] analyAns; ------------------------------------------------------------------------------ string[] tempStr; tempStudentAns = tempStr[3].ToCharArray(); for (int i = 0; i < tempStudentAns.Length; i++) noAns[i] += tempStudentAns[i]; for (int i = 0; i < noAns.Length; i++) //出現錯誤的部分 analyAns = noAns[i].ToCharArray(); //想隨著程式進行 改變analyAns的參考物件 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.228.81.178 ※ 編輯: bluela 來自: 61.228.81.178 (06/18 21:05)
james732:private string[] noAns = new string[....]; 06/18 21:25
bluela:痾...不懂樓上的意思@@ 06/18 21:39
kinwind:一樓的意思 應該是指你的noAns要初始化 去new一下 06/18 22:36
bluela:謝謝!!!我不小心把初始化放到Form的建構子中了 囧> 06/18 23:39