为什么会返回错误?
尽管如此,这并不会:
public class Class1
{
public enum MyEnum
{
First,
Second,
Third
}
public MyEnum[] myEnum;
public Class1()
{
myEnum =
{
MyEnum.First,
MyEnum.First,
MyEnum.First
};
}
}
尽管如此,这并不会:
public class Class1
{
enum MyEnum
{
First,
Second,
Third
}
public MyEnum[] myEnum =
{
MyEnum.First,
MyEnum.First,
MyEnum.First
};
public Class1()
{
}
}
我希望能够采用第一种方式,这样我就可以将初始化与构造函数分开。应该如何正确实现?