enum de comarcas de cataluña in csharp

To define an enum of the comarcas of Catalonia in C#, you can use the following code:

main.cs
public enum Comarca {
  AltEmporda,
  BaixEmporda,
  Garrotxa,
  AltUrgell,
  BaixaCerdanya,
  Bergueda,
  Maresme,
  VallesOriental,
  VallesOccidental,
  Anoia,
  Bages,
  Emporda,
  Montsia,
  RiberaEbre,
  Segarra,
  Segria,
  Solsones,
  Tarragones,
  TerraAlta
}
269 chars
22 lines

This defines an enum called Comarca with 19 fields, each one corresponding to a comarca of Catalonia. You can use it in your C# code by referring to the enum values by their name, for example:

main.cs
Comarca selectedComarca = Comarca.AltEmporda;
if (selectedComarca == Comarca.BaixEmporda) {
  Console.WriteLine("You selected Baix Empordà.");
}
145 chars
5 lines

gistlibby LogSnag