[Vala] Working with enums in Vala



Hi,

What do people do in Vala today in order to:
A) print an enum value to the screen? (in C# Enum.GetName() can be used)
B) Convert an int or string to some enum? (for instance if you have the int 3 but the enum only contains 1 
and 2 then I want some runtime error. In C# this would be the Enum.Parse() method).

Ideally I don't want to implement these functions myself because then I must update the functions whenever I 
change the enum (that will be unnecessarily error prone).



                Martin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]