Play Twenty C# Questions Explained: (15) How do I get the string value of an enum?
Demonstrate the use of Enum.GetName() and ToString().
Full course outline:
- 01: When do you use structs vs classes?
- 02: How does one parse XML files?
- 03: What is the difference between String and string?
- 04: How do I get the application’s path in a C# console app?
- 05: How do you call a base constructor in C#?
- 06: How would you count the occurrences of a string within a string?
- 07: How do you check if a number is a power of 2?
- 08: What is the difference between break and continue in a loop?
- 09: What is the difference between abstract and virtual functions?
- 10: What is the difference between ref and out keywords?
- 11: How do I encrypt/decrypt a string in .NET?
- 12: How do I get the index of the current iteration of a foreach loop?
- 13: How do I get my own IP address in C#?
- 14: How do I calculate someone’s age in C#?
- 15: How do I get the string value of an enum?
- 16: How do I make a text box that only accepts numbers?
- 17: How do I round a decimal value to two places for output?
- 18: How do I remove duplicates from an array?
- 19: How do I sort a dictionary by value?
- 20: How can I return multiple values from a function in C#?