1
Ladies and gentlemen, I have a question here of converting a enum
in a string
, but I need the conversion to be filled with zero to keep 2 digits.
Example
public enum System
{
Unknown = 0,
Mirror = 3,
Order = 17
}
the Enum Mirror the out put would be "03".
tried with this example below worked
int value;
value = 3;
Console.WriteLine(value.ToString("D2"));
// Displays 03
But with Enum it doesn’t work.
Console.WriteLine(SourceSystem.Mirror.ToString("D2"));
The Following error appears:
System.FormatException Message=Format String can be only "G", "g", "X", "x", "F", "f", "D" or "d".....
Follows the enum
:
public enum SourceSystem
{
Unknown = 0,
Mirror = 3,
MirrorTrident = 17
}