开发者

Declaring an enum as a class member

开发者_开发问答

Is there any mechanism in C# that allows one to define and declare an Enum variable in the same line like so:

public class ClassWithEnumMember
{
    public Enum Type { TYPE1, TYPE2, TYPE3 } = TYPE1;
}


public enum Foo { Bar, Baz }; public Foo myField = Foo.Bar;

All neatly on one line!


This simplest answer is no. Why not just make it two lines?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜