NenTang.vn
.NETLập trình căn bản C#
Enums trong C#
Nhập môn Lập trình C#
Thời lượng: 173 phútĐọc khoảng: 1 phút
Từ viết tắt
Nội dung bài học không khai báo từ viết tắt bằng thẻ abbr.
Nội dung bài học
An enumeration is a set of named integer constants. An enumerated type is declared using the enum keyword.
C# enumerations are value data type. In other words, enumeration contains its own values and cannot inherit or cannot pass inheritance.
Where,
When the above code is compiled and executed, it produces the following result −
Declaring enum Variable
The general syntax for declaring an enumeration is −csharp
- The enum_name specifies the enumeration type name.
- The enumeration list is a comma-separated list of identifiers.
csharp
Example
The following example demonstrates use of enum variable −csharp
shellscript

