Say, I have the following enum and the code testing enum:
enum Flag
{
On,
Off
}
string GetMessage(Flag flag) =>
flag switch
{
Flag.On => "State is ON",
Flag.Off => "State is OFF"
};
However, I get the warning:
Warning CS8509 The switch expression does not handle all possible values of its input type (it is not exhaustive). For example, the pattern '(ConsoleApp.Flag)2' is not covered.
Why it's not exhaustive when I listed all enum's values? And what is (ConsoleApp.Flg)2 enum value?