From the course: Visual Studio Developer Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Enum flags

Enum flags

- [Narrator] In this tip, I'll look at the enumeration type and show some simple enhancements. I've got a couple of enums defined here in this enums dot cs file. The first one we'll look at is the months enum and later we'll look at the days enum. I'm using this in a class, this tour class. The idea is that these are the tours our company offers and the tours are available in certain months. That's our available months property and there's also the available days property. And the type of the available month is my enum value months. So then I can use that over here by saying substantiate the tour on line 13. On line 14 I set the tour name. And then on line 15 I specify the available months using the months enumerator value for May. Now the actual numeric value that's stored in here is, let me show you, it's over here, it's going to be the value of five. Switchback over here. When I go and call available months dot to string, I'll get the string representation of the month. I want to…

Contents