This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Text; | |
| namespace TiposJogosComAtributo.Atributos | |
| { | |
| [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] | |
| public class Descricao : Attribute | |
| { | |
| public string Valor { get; private set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace TiposJogosComSwitch | |
| { | |
| public class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| TipoJogo tipoJogo = TipoJogo.RPG; | |
| Console.WriteLine(tipoJogo.GetDescricao()); | |
| // No console --> Role-playing game |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace TiposJogosComSwitch | |
| { | |
| public static class TipoJogoDescricao | |
| { | |
| public static string GetDescricao(this TipoJogo tipoJogo) | |
| { | |
| switch (tipoJogo) | |
| { | |
| case TipoJogo.ACAO: | |
| return "Ação"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace TiposJogosComSwitch | |
| { | |
| public enum TipoJogo | |
| { | |
| ACAO, AVENTURA, RPG | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public enum TipoJogo { | |
| ACAO("Ação"), AVENTURA("Aventura"), RPG("Role-playing game"); | |
| private String descricao; | |
| private TipoJogo(String descricao) { | |
| this.descricao = descricao; | |
| } | |
| public String getDescricao() { |
NewerOlder