日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
C#枚舉類型使用的一點(diǎn)總結(jié)

C#枚舉類型使用的時(shí)候需要掌握的有哪些方面呢?首先我們來看看一個(gè)例子:

從網(wǎng)站建設(shè)到定制行業(yè)解決方案,為提供做網(wǎng)站、成都做網(wǎng)站服務(wù)體系,各種行業(yè)企業(yè)客戶提供網(wǎng)站建設(shè)解決方案,助力業(yè)務(wù)快速發(fā)展。創(chuàng)新互聯(lián)將不斷加快創(chuàng)新步伐,提供優(yōu)質(zhì)的建站服務(wù)。

 
 
 
  1. public enum Colors { Red = 1, Green = 2,
  2. Blue = 4, Yellow = 8 }; 
  3. The entries of the Colors Enum are:
  4. Red
  5. Green
  6. Blue
  7. Yellow

C#枚舉類型使用的一點(diǎn)總結(jié)之根據(jù)name獲得Enum的類型:

 
 
 
  1. Colors mycolor = (Colors)Enum.Parse(
  2. typeof(Colors),"red",true);
  3. (int)mycolor1=1
  4. mycolor1.GetTypeCode=Int32

C#枚舉類型使用的一點(diǎn)總結(jié)之根據(jù)value獲得Enum的類型:

 
 
 
  1. Colors mycolor = (Colors)Enum.Parse(
  2. typeof(Colors),"1",true);
  3. mycolor2.ToString()=Red
  4. mycolor2.GetTypeCode=Int32

C#枚舉類型使用的一點(diǎn)總結(jié)之遍歷枚舉內(nèi)容

 
 
 
  1. foreach(string s in Enum.GetNames(typeof(Colors)))
  2. {
  3. //to do 
  4. }
  5. Colors myOrange = (Colors)Enum.Parse(
  6. typeof(Colors), "Red, Blue,Yellow");
  7. The myOrange value has the combined 
  8. entries of [myOrange.ToString()]=13
  9. Colors myOrange2 = (Colors)Enum.Parse(
  10. typeof(Colors), "Red, Blue");
  11. The myOrange2 value has the combined 
  12. entries of [myOrange2.ToString()]=5 

C#枚舉類型使用的一點(diǎn)總結(jié)的內(nèi)容就向你介紹到這里,希望對你了解和學(xué)習(xí)C#枚舉類型有所幫助。


本文題目:C#枚舉類型使用的一點(diǎn)總結(jié)
文章源于:http://www.dlmjj.cn/article/djcgsje.html