Znav |
---|
next | C-Sharp Mapping for Structures |
---|
prev | C-Sharp Mapping for Built-In Types |
---|
|
A Slice enumeration maps to the corresponding enumeration in C#. For example:
Wiki Markup |
---|
{zcode:slice}
enum Fruit { Apple, Pear, Orange };
{zcode} |
Not surprisingly, the generated C# definition is very similar:
Wiki Markup |
---|
{zcode:cs}
public enum Fruit { Apple, Pear, Orange }
{zcode} |
Suppose we modify the Slice definition to include a custom enumerator value:
Wiki Markup |
---|
{zcode:slice}
enum Fruit { Apple, Pear = 3, Orange };
{zcode} |
The generated C# definition now includes an explicit initializer for every enumerator:
Wiki Markup |
---|
{zcode:cs}
public enum Fruit { Apple = 0, Pear = 3, Orange = 4 }
{zcode} |
See Also
Znav |
---|
next | C-Sharp Mapping for Structures |
---|
prev | C-Sharp Mapping for Built-In Types |
---|
|