csdn_wuwt 2019-09-29 18:01 采纳率: 0%
浏览 631

enum与int转换问题,枚举直接赋值1,怎样才能支持?

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public enum Type
    {
        A,
        B,
        C,
    }

    class Program
    {
        static void Main(string[] args)
        {
            // 这句话怎么支持?

            Type type = 1;
        }
    }
}
  • 写回答

2条回答 默认 最新

  • 知了的夏天 2019-09-29 19:26
    关注

    A = 1,
    B = 2,
    C = 3,
    试试

    评论

报告相同问题?