所以我有一个类,它有一个字符串数组的参数。我想要做的是将多个字符串存储到这个属于此类的数组中。代码看起来像这样:
//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.
如有任何帮助,我们将不胜感激!
最佳答案
将座位号放入事件构造函数时,请将其从括号中移除。
关于c# - 使用字符串数组作为对象参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30066118/