【发布时间】:2015-07-15 23:06:50
【问题描述】:
所以我有一个具有字符串数组参数的类。我想要做的是将多个字符串存储到这个属于这个类的数组中。代码如下所示:
//Class part of it. Class is called "Event"
public class Event
{
public string[] seats = new string [75];
public Event(string[] seats)
{
this.seats = seats;
}
}
// the main code that uses "Event" Class
string[] seatnumber = new string[75];
Event show = new Event (seatnumber[]); //And that is where the error comes in.
任何帮助将不胜感激!
【问题讨论】:
-
在将座位号放入 Event 构造函数时,去掉括号内的括号。
-
括号是类型声明、构造和元素检索的一部分。你需要传递引用变量,它的名字是
seatnumber