public static string GetMensagem(this Mensagem value) { var name = Enum.GetName(value.GetType(), value); var attribute = (CustomAttribute) typeof(Mensagem) .GetField(name) .GetCustomAttributes(typeof(CustomAttribute), false).First(); return(attribute.Mensagem); }