Circular definition in a constant enum

后端 未结 4 1770
别跟我提以往
别跟我提以往 2021-01-04 01:18

I\'m trying to create a constant of type Enum but I get a error.. My enum is:

public enum ActivityStatus
{
    Open = 1,
    Close = 2
}
         


        
4条回答
  •  感情败类
    2021-01-04 01:56

    If private usage only: You can change ActivityStatus to readonly field and move setting of default value to constructor.

    If public usage: You can use property with getter only.

    In most of the code analyzers additional namespace will be treated as redundance in your code.

提交回复
热议问题