开发者

Declaring an enum as a class member

开发者 https://www.devze.com 2022-12-25 22:17 出处:网络
开发者_开发问答Is there any mechanism in C# that allows one to define and declare an Enum variable in the same line like so:
开发者_开发问答

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

精彩评论

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