I have an enum (enumeration) calling Notas
and I need to get the integer corresponding to one of its constants.
public enum Nota
{
Otimo = 5,
MuitoBom = 4,
Bom = 3,
Regular = 2,
Ruim = 1,
Insuficiente = 0
}
I tried the following, but I did not succeed:
Aluno aluno = new Aluno();
aluno.Nota = Nota.MuitoBom;
The property Conceito
is integer type and even then I can not get the integer value of the Nota.MuitoBom
constant, since the compiler says that it can not implicitly convert type Nota
to int
.