2
Follows code:
class Program
{
public enum Enum
{
Casa = 0,
Apartamento = 5
}
public static string MinhaFuncao(Enum @enum) => "MinhaFuncao";
static void Main(string[] args)
{
var r = MinhaFuncao(0);
}
}
Why can’t I put for example: MinhaFuncao(5);
?
The zero integer (0) accepts, now other than zero (1, 2, 3...) does not accept.
I get error:
Cannot convert from "int" to "Console.Program.Enum".
Can you avoid zero integer in the ? parameter
Enum.Casa
, without using a whole number.– Matheus Miranda
No, that’s one of the flaws of
enum
of C#, one of the most criticized features of language.– Maniero