I started working on a large C # code base and found using a static class with multiple lines of int ints. This class acts just like an enumeration.
I would like to convert the class to an actual enumeration, but the credentials to be specified are not. The main reason I would like to convert it is because I could list it as a data type, not an int. This would help a lot with readability.
Is there a reason not to use enums and use const ints instead? This is currently the code:
public int FieldA { get; set; } public int FieldB { get; set; } public static class Ids { public const int ItemA = 1; public const int ItemB = 2; public const int ItemC = 3; public const int ItemD = 4; public const int ItemE = 5; public const int ItemF = 6; }
However, I think it should be as follows:
public Ids FieldA { get; set; } public Ids FieldB { get; set; }
enums c # design-patterns
Telavian
source share