Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Standard .NET side enum

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?

like image 331
AndreyAkinshin Avatar asked Jul 12 '11 08:07

AndreyAkinshin


People also ask

What is the default value of enum in C#?

The default value of an enumeration type E is the value produced by expression (E)0 , even if zero doesn't have the corresponding enum member.

Do C# enums start at 0 or 1?

Enum ValuesBy default, the first item of an enum has the value 0. The second has the value 1, and so on.

What is enum in .NET core?

The enum keyword in C# and . NET is used to declare an enumeration, a distinct type that consists of a set of named constants called the enumerator list. Usually, an enum is declared as public within a namespace and is available to all classes in the namespace.

What is enum in C#?

Enumeration (or enum) is a value data type in C#. It is mainly used to assign the names or string values to integral constants, that make a program easy to read and maintain.


2 Answers

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.

like image 158
Adam Houldsworth Avatar answered Oct 21 '22 23:10

Adam Houldsworth


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.

like image 2
CrazyIvan1974 Avatar answered Oct 22 '22 01:10

CrazyIvan1974