This article is taken from the csdn forum post
Q: Question
The tostring () method of the enum class can be different from several parameters, such:
Enum. tostring ("D ");
Enum. tostring ("N ");
Enum. tostring ("G ");
Enum. tostring ("F ");
What do the parameters "N", "g", and "F" mean?
A: Answer
"G" or "G"
If value is equal to a named enumerated constant, the name of the constant is returned; otherwise, the equivalent of the value is returned.
Number.
For example, assume that the unique enumerated constant is named "red" and its value is 1. If the value is set to 1, this format is returned.
Return "red ". However, if the value is set to 2, this format returns "2 ".
-Or-
If the flagsattribute custom attribute is applied to enumeration, the value is considered as a bit field, which contains
Or multiple signs composed of one or more digits.
If value is equal to a combination of named enumerated constants, a list of these constant names separated by delimiters is returned. In
Search for a flag in value, from a flag with the maximum value to a flag with the minimum value. For bitwise fields in the same value
For each identifier, the constant name is connected to the list separated by delimiters. The value of the tag will not be considered, and the next search will continue
.
If value is not equal to the combination of named enumerated constants, the equivalent decimal number of value is returned.
"X" or "X"
Value in hexadecimal format (without leading "0x ").
"D" or "D"
Value in decimal format.
"F" or "F"
The execution of "G" or "G" is the same, but flagsattribute is not required in the enum declaration.