我在operation.cs中聲明了一個(gè)枚舉類型: public enum order { NewAccount, FindAccount }在test.cs中使用的時(shí)候報(bào)錯(cuò):public class test{ public static void Main(String[] args) { order operationOrder; Console.WriteLine(operationOrder.NewAccount); }}無(wú)法使用實(shí)例引用訪問(wèn)靜態(tài)成員“order.NewAccount”;改用類型名來(lái)限定它 問(wèn)題補(bǔ)充: 剛剛那個(gè)問(wèn)題已經(jīng)解決,現(xiàn)在我想這么用: order operationOrder; switch (operationOrder) { case order.NewAccount: Bank bank1 = new Bank(); Console.WriteLine("請(qǐng)輸入姓名:"); string name = Console.ReadLine(); Console.WriteLine("請(qǐng)輸入身份證號(hào)碼:"); string identityCard = Console.ReadLine(); string blance = Console.ReadLine(); break; case order.FindAccount: Console.WriteLine("待開(kāi)發(fā)"); } 請(qǐng)為該怎么為operationOrder賦值?
關(guān)于枚舉類型的使用
幕布斯6054654
2018-12-25 13:08:33