I have a doubt with enums if I defined a enums that inherited from short like this:
public enum ProyectoEstatus : short
{
EstatusPorDefecto = 26,
AprobadoUnidadNegocio = 6,
CanceladoAreaComercial = 18
}
why am i unble to do this??
Nullable<short> aux = ProyectoEstatus.CanceladoAreaComercial as ProyectoEstatus;
If my type of my variable called aux is Nullable
First, the
enumtype itself is not nullable, so theasoperator will not work on it.Secondly, the
enumtype is not actually ashort. It is ashort-backed enum type, but it will need to be explicitly cast into a short before it can undergo the implicit cast fromshorttoNullable<short>: