I want to set the space on my enum. Here is my code sample:
public enum category
{
goodBoy=1,
BadBoy
}
I want to set
public enum MyEnum { With_Space, With_Two_Spaces } //I store spaces as underscore. Actual values are 'With Space' and 'With Two Spaces'
public MyEnum[] arrayEnum = (MyEnum[])Enum.GetValues(typeof(MyEnum));
string firstEnumValue = String.Concat(arrayEnum[0].ToString().Replace('_', ' ')) //I get 'With Space' as first value
string SecondEnumValue = String.Concat(arrayEnum[1].ToString().Replace('_', ' ')) //I get 'With Two Spaces' as second value
An enumerator cannot contain white space in its name.
As we know that enum is keyword used to declare enumeration.
you can check throw this link https://msdn.microsoft.com/en-us/library/sbbt4032.aspx