It seems that Enum.GetName() does not work if enum was decorated with the [Flags] attribute.
Documentation does not indicate anything related to this restriction.
I noticed that the debugger is able to display something like Tree | Fruit . Is there a way to get a text string describing the combined flags?
Displays the following Red code.
 public enum FavoriteColor { Red, Blue, WeirdBrownish, YouDoNotEvenWantToKnow, } var color = FavoriteColor.Red; Console.WriteLine(Enum.GetName(typeof(FavoriteColor), color));  
While this one doesn’t output anything ....
 [Flags] public enum ACherryIsA { Tree = 1, Fruit = 2, SorryWhatWasTheQuestionAgain = 4, } var twoOfThree = ACherryIsA.Fruit | ACherryIsA.Tree; Console.WriteLine(Enum.GetName(typeof(ACherryIsA), twoOfThree));  
source share