Answered by:
Enum

Question
-
Hi,
I want to know what is enum and when and where do we use this enum
please explain in simple words with nice example
waiting for replay....
Wednesday, August 1, 2012 12:06 PM
Answers
-
Read here its well explained:
- http://msdn.microsoft.com/en-us/library/sbbt4032(v=vs.80).aspx
- http://csharp.net-tutorials.com/advanced/enumerations/
Enum(s) can be used instead of some text where you have multiple variables. Beside each item in enum can have its value, for example: 1st item has 1, 2nd item nas 2 (for next items you dont need to define, becuase the code recognizes the step from 1st and 2nd, so it automatically know that 2rd item has value 3, 4th value 5, and so on - enumeration by 1 is actually default enum behaviour. You can actually enumerate by 2 for example, so setting 1st enum to 1, 2nd to 3, and all others will be set automatically (3rd to 5, 4th to 7, and so on).
Enum items can even have a description - "funny" thing is that item of enum cannot be white spaces (no white space allowed), thats why defining a description you can describe it with longer words and whitespaces allowed. How to use Description:
http://stackoverflow.com/questions/5794071/c-sharp-enum-with-description-not-working
http://stackoverflow.com/questions/2650080/how-to-get-c-sharp-enum-description-from-value
Mitja
- Edited by Mitja Bonca Wednesday, August 1, 2012 12:33 PM
- Proposed as answer by Jo Swa(K.P.Elayaraja)-MCP Wednesday, August 1, 2012 1:41 PM
- Marked as answer by Bob ShenModerator Wednesday, August 15, 2012 9:52 AM
Wednesday, August 1, 2012 12:15 PM -
Please get the answer why use enum? from the following URL
http://social.msdn.microsoft.com/Forums/eu/vblanguage/thread/6f5ddf4d-0140-45ac-bd88-cf36c26e11b7
With Thanks and Regards
Sambath Raj.C
click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you
Happy Programming!- Marked as answer by Bob ShenModerator Wednesday, August 15, 2012 9:52 AM
Wednesday, August 1, 2012 1:11 PM
All replies
-
Read here its well explained:
- http://msdn.microsoft.com/en-us/library/sbbt4032(v=vs.80).aspx
- http://csharp.net-tutorials.com/advanced/enumerations/
Enum(s) can be used instead of some text where you have multiple variables. Beside each item in enum can have its value, for example: 1st item has 1, 2nd item nas 2 (for next items you dont need to define, becuase the code recognizes the step from 1st and 2nd, so it automatically know that 2rd item has value 3, 4th value 5, and so on - enumeration by 1 is actually default enum behaviour. You can actually enumerate by 2 for example, so setting 1st enum to 1, 2nd to 3, and all others will be set automatically (3rd to 5, 4th to 7, and so on).
Enum items can even have a description - "funny" thing is that item of enum cannot be white spaces (no white space allowed), thats why defining a description you can describe it with longer words and whitespaces allowed. How to use Description:
http://stackoverflow.com/questions/5794071/c-sharp-enum-with-description-not-working
http://stackoverflow.com/questions/2650080/how-to-get-c-sharp-enum-description-from-value
Mitja
- Edited by Mitja Bonca Wednesday, August 1, 2012 12:33 PM
- Proposed as answer by Jo Swa(K.P.Elayaraja)-MCP Wednesday, August 1, 2012 1:41 PM
- Marked as answer by Bob ShenModerator Wednesday, August 15, 2012 9:52 AM
Wednesday, August 1, 2012 12:15 PM -
Please get the answer why use enum? from the following URL
http://social.msdn.microsoft.com/Forums/eu/vblanguage/thread/6f5ddf4d-0140-45ac-bd88-cf36c26e11b7
With Thanks and Regards
Sambath Raj.C
click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you
Happy Programming!- Marked as answer by Bob ShenModerator Wednesday, August 15, 2012 9:52 AM
Wednesday, August 1, 2012 1:11 PM