Re: [Vala] Array as big as an enum
- From: Ulink <ulink gmx at>
- To: "vala-list gnome org" <vala-list gnome org>
- Subject: Re: [Vala] Array as big as an enum
- Date: Thu, 1 Sep 2016 09:14:36 +0200
Hi,
and last but not least one may overwrite the to_string method to get own
strings like this:
enum Test {
ONE,
TWO;
public string to_string() {
switch(this) {
case ONE:
return "enum number one";
case TWO:
return "enum number two";
default:
return "weeeee, unknown enum number "+((int)this).to_string();
}
}
}
This is for example VERY nice to convert error numbers to error strings.
--
Bernhard
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]