mousemat24
asked on
How to convert (DayOfWeek) to a list?
Hi
There is a (DayOfWeek) prop in .net
what I want to do is create a list based on that, can someone please help me?
also it must work with int i.e.
if I have a day with int which is set to 2 doing (DayOfWeek)item.day will show Tuesday
Hope this makes sense?
thanks
There is a (DayOfWeek) prop in .net
what I want to do is create a list based on that, can someone please help me?
also it must work with int i.e.
if I have a day with int which is set to 2 doing (DayOfWeek)item.day will show Tuesday
Hope this makes sense?
thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
C'est la vie.
The great thing about enums in .NET is that when you call their ToString method, you get back the name of the member, not its value:
e.g.
Open in new window
Just make sure you are working with an instance of the enum, not the integer itself--i.e. cast it as in the above.