自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

C#枚舉類型實(shí)例演示

開發(fā) 后端
C#枚舉類型實(shí)例演示中向你展示了C#枚舉類型的具體使用,希望對(duì)你學(xué)習(xí)和了解C#枚舉類型有所幫助。

C#枚舉類型實(shí)例演示

  1. /*  
  2.  * Created by SharpDevelop.  
  3.  * User: noo  
  4.  * Date: 2009-8-16  
  5.  * Time: 21:03  
  6.  *   
  7.  * C#枚舉類型  
  8.  */ 
  9.  
  10. using System ;  
  11. enum enumA:int 
  12. {  
  13.     east,//0  
  14.     south,//1  
  15.     west,//2  
  16.     north,//3  
  17. }  
  18. enum enumB//默認(rèn)是int型的  
  19. {  
  20.     left,//0  
  21.     right,//1  
  22. }  
  23. enum enumC:byte 
  24. {  
  25.     top,  
  26.     buttom,  
  27. }  //C#枚舉類型
  28. class Test  
  29. {  
  30.     static void Main()  
  31.     {  
  32.         enumA a=enumA.east;  
  33.         enumA b=enumA.south;  
  34.         enumA c=enumA.west;  
  35.         enumA d=enumA.north;  
  36.         Console.WriteLine (a);  
  37.         Console.WriteLine (b);  
  38.         Console.WriteLine (c);  
  39.         Console.WriteLine (d);  
  40.           
  41.         int aa=(int)enumA.east;  
  42.         int bb=(int)enumA.south;  
  43.         int cc=(int)enumA.west;  
  44.         int dd=(int)enumA.north;  
  45.         Console.WriteLine (aa);  
  46.         Console.WriteLine (bb);  
  47.         Console.WriteLine (cc);  
  48.         Console.WriteLine (dd);  
  49.           
  50.         enumB x=enumB.left ;  
  51.         enumB y=enumB.right ;  
  52.         int z=(int)enumB.left;  
  53.         Console.WriteLine (x);  
  54.         Console.WriteLine (y);  
  55.         Console.WriteLine (z);  
  56.          //C#枚舉類型 
  57.         enumC p=enumC.top ;  
  58.         enumC q=enumC.buttom ;  
  59.         byte r=(byte)enumC.buttom ;  
  60.         Console.WriteLine (p);  
  61.         Console.WriteLine (q);  
  62.         Console.WriteLine (r);  
  63.     }  

C#枚舉類型實(shí)例運(yùn)行結(jié)果

C#枚舉類型實(shí)例運(yùn)行結(jié)果

C#枚舉類型實(shí)例演示的基本情況就向你介紹到這里,希望對(duì)你了解和學(xué)習(xí)C#枚舉類型有所幫助。

【編輯推薦】

  1. C# 枚舉常用方法淺析
  2. C# 枚舉和常量應(yīng)用區(qū)別淺析
  3. 學(xué)習(xí)C# 枚舉的那點(diǎn)東西
  4. C#枚舉類型的使用淺析
  5. C#枚舉類型概念及應(yīng)用淺析
責(zé)任編輯:仲衡 來源: 博客園
相關(guān)推薦

2009-08-18 10:47:40

C#枚舉類型

2009-08-18 10:41:38

C#枚舉類型

2009-08-17 17:49:20

C# 枚舉

2009-08-26 15:35:59

C#虛函數(shù)

2009-08-18 13:30:01

C#安裝與部署

2009-08-18 10:35:46

C#枚舉類型

2009-08-18 12:52:33

C#枚舉類型

2009-09-01 18:29:10

C#繼承C#多態(tài)

2009-08-18 13:00:59

C#枚舉類型

2009-08-18 09:37:14

C#枚舉類型

2009-08-18 10:30:30

C#枚舉

2009-08-18 09:51:18

C#枚舉類型

2009-08-18 10:59:46

C#枚舉類型

2009-08-13 18:26:35

C#繼承構(gòu)造函數(shù)

2009-08-18 11:07:06

C#枚舉類型

2024-04-07 07:49:05

C#Switch模式匹配

2009-08-18 13:06:17

C#枚舉類型

2010-03-02 14:12:30

WCF枚舉類型

2009-08-14 13:52:18

C#判斷數(shù)據(jù)類型

2009-08-17 17:56:32

C# 枚舉
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)