Enum and property naming conflicts

后端 未结 2 2015
南笙
南笙 2020-12-08 13:34

When using a class that has an enum property, one usually gets a naming conflict between the property name and the enum type. Example:

enum Day{ Monday, Tues         


        
2条回答
  •  伪装坚强ぢ
    2020-12-08 14:20

    So long as the enumeration isn't nested within MyDateClass, I don't see that that's a problem. It's far from uncommon (in my experience) to have a property with the same name as the type it returns. I'll see if I can find some examples in the framework...

    EDIT: First example: DateTimeOffset.DateTime (not an enum, but that's somewhat irrelevant)

提交回复
热议问题