【发布时间】:2011-12-31 05:22:27
【问题描述】:
这是 UpdateGUI() 的一部分:
DisplayOptions choice = (DisplayOptions)comboBox1.SelectedIndex;
seatMngr.GetSeatInfoStrings(choice, out strSeatInfoStrings);
listBox1.Items.Clear();
listBox1.Items.AddRange(strSeatInfoStrings);
编译器在抱怨这一行(以及最后一行的参数):
seatMngr.GetSeatInfoStrings(choice, out strSeatInfoStrings);
我要做的是获取一个数组 (strSeatInfoStrings) 并将其放入一个列表框中。
有什么想法吗?
【问题讨论】:
-
您是否有任何特殊原因需要使用
out而不仅仅是从方法中返回数组? -
你从编译器得到什么错误信息?
-
是的,我需要用out...我得到的错误信息是:#1"当前上下文中不存在名称'strSeatInfoStrings'"#2"匹配'的最佳重载方法Assignment3.SeatManager.GetSeatInfoStrings(Assignment3.DisplayOptions, out string[])' has some invalid arguments" #3"参数 2:无法从 'out strSeatInfoStrings' 转换为 'out string[]'"