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 } and I have a model that uses it:
public class CreateActivity { public int Id; public const ActivityStatus ActivityStatus = ActivityStatus.Open; } the following error occurs:
Error 1 The evaluation of the constant value for 'Help_Desk.Models.CreateActivity.ActivityStatus' involves a circular definition...
But if I change the name of ActivityStatus property it works!
public class CreateActivity { public int Id; public const ActivityStatus AnyOtherName = ActivityStatus.Open; } Why it happens?
const(possibly specifyingstaticand/orreadonlyinstead), it works! C# Language Specification section 7.6.4.1 applies in most cases, but why not in yours?