Enums in C sharp arabic #46

 


Enums in C sharp arabic #46

Suggested Videos




Enums

If a program uses set of integral numbers, consider replacing them with enums , which makes the program more.

Readable
Maintainable

1. Enums are enumerations. 

2. Enums are strongly typed constants . hence, an explicit cast is needed to convert from enums type to an integral type and vice versa. Also , an enum of one type cannot be implicitly assigned to an enum of another type even though the underlying value of their members are the same . 

3. The default underlying type of an enum is int.

4. The default value for first element is ZERO and gets incremented by 1. 

5. It is possible  to customize the underting type and values. 

6. Enums are value types. 

7. Enum keyword (all small letteres) is used to create enumerations, where as Enum class, contains static GetValues() and GetValues() methods which can be used to list enum underlying type values and Names







Note : Use short .MaxValue to find out the maximum value that a short  data type can hold

Follow Us

YouTube

 If you want to download pptx : click Telegram

Facebook

Twitter

Instagram

Tik Tok




إرسال تعليق

أحدث أقدم