初学c#,有个小问题,以下代码正确吗,为什么这几行总是报错,有劳各位大神帮忙看看
using System;
namespace jiang
{
enum Color{
blue,yellow,red
} ;
public Color a = Color.blue;
public Color b = Color.yellow;
public Color c = Color.red;
class MainClass
{
public static void main ()
{
char let;
let = Convert.ToInt32(console.ReadLine());
switch (let)
{
case a:
console.WriteLine (a);
break;
case b:
console.WriteLine (b);
break;
case c:
console.WriteLine (c);
break;
default:
console.WriteLine ("error!");
break;
}
}
}
你这三个....字段应该放在class里面,你直接丢namespace下这个算谁的?
en嗯嗯,知道了,谢谢