我想输入一个数字并让控制台程序从枚举返回项目的名称
using System;
namespace ConsoleApp7
{
class Program
{
enum planets { Mercury = 1, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune};
static void Main(string[] args)
{
int selection = Convert.ToInt32(Console.ReadLine());
selection = enum planets;
Console.WriteLine("{0} is {1} planet(s) from the sun", planets, selection);
Console.Readkey();
}
}
}
慕容708150
相关分类