新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
C#枚舉類型語法淺析
C#枚舉類型語法是什么呢?讓我看看下面的講解:

10年積累的網(wǎng)站制作、網(wǎng)站建設(shè)經(jīng)驗(yàn),可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有青田免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
- /*C#枚舉
- *當(dāng)你想讓一組數(shù)字代表特定的意義,並且希望是安全的,可讀性強(qiáng).
- *
- *C#枚舉類型是以"自己的方式使用整型"
- *C#枚舉類型可以是:byte,sbyte,short,ushort,int,uint,long,ulong的子類
- *如果沒有指定類型,則默認(rèn)為int類型
- *
- *C#枚舉類型的大小是所有元索的大小的總和
- *
- */
- usingSystem; //C#枚舉類型
- classTest
- {
- //enumColor{Red,Gree,Blue}
- //enumColor{Red=6,Gree=8,Blue=10};//也可以指定其值
- enumColor:byte{Red=6,Gree=8,Blue=10};//指定存儲類型
- privatestaticstringStringFromColor(Colorcolor)
- {
- returncolor.ToString();
- }
- staticvoidMain()
- { //C#枚舉類型
- Colorc=Color.Red;
- Console.WriteLine(c.ToString());
- Console.WriteLine(StringFromColor(c));
- intn=(int)Color.Red;
- Console.WriteLine(n);
- }
- }
C#枚舉類型語法方面的學(xué)習(xí)實(shí)例就向你介紹到這里,希望對你了解和學(xué)習(xí)C#枚舉類型有所幫助。
網(wǎng)站標(biāo)題:C#枚舉類型語法淺析
分享鏈接:http://m.jiaoqi3.com/article/dppchec.html


咨詢
建站咨詢
