// enum
class Practice9_1
{
static void Main(string[] args)
{
// Enum -> 数値
long i = (long)Season.Autumn;
// 数値 -> Enum型
Season s = (Season)Enum.Parse(typeof(Season), i.ToString());
Console.WriteLine(i);
Console.WriteLine(s);
}
}
enum Season : long
{
Spring = 1,
Summer = 2,
Autumn = 3,
Winter = 4
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme