Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
CSharp /
20180406dEnumerationsDefine it directly in the namespace, outside of any classes. namespace GettingStarted { public enum DaysOfWeek { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday } ... } DayOfWeek today = DayOfWeek.Monday; WriteLine(today == DayOfWeek.Monday); // true var tomorrow = DayOfWeek.Tuesday; WriteLine(tomorrow); // Tuesday , but it is NOT a string! WriteLine(tomorrow.GetType()); // System.DayOfWeek WriteLine(tomorrow.ToString()); // "Tuesday" , now it is a string |
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |