Where is the best place to locate enum types?

前端 未结 10 2131
自闭症患者
自闭症患者 2020-12-25 11:16

I have found that there is generally a singe type or namespace that takes in any particular enum as a parameter and as a result I have always defined those enums there. Rece

10条回答
  •  半阙折子戏
    2020-12-25 12:10

    Why treat enums differently to other types? Keep them in the same namespace as they're likely to be used - and assuming they're going to be used by other classes, make them top-level types in their own files.

    The only type of type which I do commonly clump together is delegates - I sometimes have a Delegates.cs file with a bunch of delegates in. Less so with .NET 3.5 and Func/Action, mind you.

提交回复
热议问题