Should enumerations be placed in a separate file or within another class?

.net, c#, enums

Solution

If the enum is only relevant to one class, it may make sense to make it a nested type. If it could be used elsewhere, it makes sense to make it a top-level type.

Problem

I currently have a class file with the following enumeration: ``` using System; namespace Helper { public enum ProcessType { Word = 0, Adobe = 1, } } ``` Or should I include the enumeration in the class where it's being used? I noticed Microsoft creates a new class file for DockStyle: ``` using System; using System.ComponentModel; using System.Drawing.Design; namespace System.Windows.Forms { public enum DockStyle { None = 0, Top = 1, Bottom = 2, Left = 3, Right = 4,. Fill = 5, } } ```

Original source