To convert an enum to string, do this:
string enumEntryAsString = Enum.GetName(typeof(TabSizeMode), TabSizeMode.FillToRight);
To convert a string to an enum type:
// Enclose this code within try/catch.
TabSizeMode sizeMode = Enum.Parse(typeof(TabSizeMode), '1');
(or)
TabSizeMode sizeMode = Enum.Parse(typeof(TabSizeMode), 'FillToRight');
Share with