22,860 questions
1140
votes
43
answers
1.3m
views
How can I represent an 'Enum' in Python?
I'm mainly a C# developer, but I'm currently working on a project in Python.
How can I represent the equivalent of an Enum in Python?
3947
votes
30
answers
2.2m
views
How do I cast int to enum in C#?
How do I cast an int to an enum in C#?
21
votes
2
answers
12k
views
Anyone know a quick way to get to custom attributes on an enum value?
This is probably best shown with an example. I have an enum with attributes:
public enum MyEnum {
[CustomInfo("This is a custom attrib")]
None = 0,
[CustomInfo("This is another attrib")]...
107
votes
13
answers
98k
views
Validate Enum Values
I need to validate an integer to know if is a valid enum value.
What is the best way to do this in C#?
1812
votes
15
answers
726k
views
What does the [Flags] Enum Attribute mean in C#?
From time to time I see an enum like the following:
[Flags]
public enum Options
{
None = 0,
Option1 = 1,
Option2 = 2,
Option3 = 4,
Option4 = 8
}
I don't understand what ...