18

I often use enums like

public enum Side { Left, Top, Right, Bottom };

or

public enum Direction { Left, Up, Right, Down };

Every time I describe the enum again. Is there a standard enum of this kind in .NET?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
AndreyAkinshin
  • 18,603
  • 29
  • 96
  • 155

2 Answers2

9

Not quite the same, but I know of the System.Windows.Forms.AnchorStyles enumeration.

http://msdn.microsoft.com/en-us/library/system.windows.forms.anchorstyles.aspx

Otherwise, I'd say not - add it to your own common library. You also have to consider the cost of taking dependencies (even on .NET Framework stuff), because of things like portability. I wouldn't take one on WinForms unless you are already depending on WinForms.

Adam Houldsworth
  • 63,413
  • 11
  • 150
  • 187
  • Yeah but it's called AnchorStyles and even the values are quite the same, the enum is **not semantically the same**. Be carefull (imagine Microsoft adding a new value to AnchorStyles in the future). – Yves M. Nov 21 '14 at 10:39
  • @YvesM. The values differ from what was stated in the question, but to your point they are very close. – Adam Houldsworth Nov 23 '14 at 18:41
2

Old and answered, but there is a ArrowDirection enum. See https://msdn.microsoft.com/en-us/library/system.windows.forms.arrowdirection(v=vs.110).aspx. Unfortunately, it is in System.Windows.Forms.

CrazyIvan1974
  • 377
  • 1
  • 2
  • 11