枚举类型都是数字类型的,所以你声明那个枚举的时候,用字符串就错了,修改成下面这样:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 枚举
{
class Program
{
//在这里枚举
enum eg{
a=1,//使用逗号
b=2,
c=3,
}
static void Main(string[] args)
{
Console.WriteLine("{0}{1}{2}",eg.a ,eg.b,eg.c);
Console.ReadLine();//阻止自动结束
}
}
}
本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。