Gambi alert
Use an enumeration:
using static System.Console;
public class Program {
public static Naipe Naipe { get; set; }
public static void Main() {
Naipe = Naipe.Copas;
WriteLine($"{(char)Naipe.Espada} {(char)Naipe.Paus} {(char)Naipe.Copas} {(char)Naipe.Ouro} {(char)Naipe}");
}
}
public enum Naipe { Espada = 9824, Paus = 9827, Copas = 9829, Ouro }
See running on .NET Fiddle . And in Coding Ground . Also I placed GitHub for future reference .
Not that it's guaranteed, but it's almost, you can get around it, but it's not the standard procedure. If you want to guarantee it would even have to include a validation on the property, but I find it unnecessary, because it will only be done wrong if the person forces. I am against being warned of stubborn programmer, prevention is good to avoid accidents.
This is not correct, but works fine. The workaround would create an attribute on each member of the enumeration with the character, does not compensate.
Another way would be to create a structure with the options and validate it, so it is guaranteed that it will never be something else. And you can easily associate the constant with the Unicode character. I do not think it's necessary, but it's better than validating on the property.