欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

C#教程

當(dāng)前位置:主頁 > 軟件編程 > C#教程 >

c# EnumHelper枚舉常用操作類

來源:本站原創(chuàng)|時間:2020-01-10|欄目:C#教程|點擊: 次

測試代碼如下:

namespace CutPictureTest.Comm
{

  public class EnumHelper
  {

    public static System.Collections.ArrayList GetName(Type enumType)
    {
      System.Collections.ArrayList arr = new System.Collections.ArrayList();
      string[] n = System.Enum.GetNames(enumType);
      foreach (string item in n)
        arr.Add(item);
      return arr;

    }

    public static T ToEnum<T>(string strEnum)
    {
      T t = (T)Enum.Parse(typeof(T), strEnum);
      return t;
    }

    public static System.Collections.Hashtable EnumToHashtable(Type enumType)
    {
      System.Collections.Hashtable ht = new System.Collections.Hashtable();
      Array arr = System.Enum.GetValues(enumType);
      for (int i = 0; i < arr.Length; i++)
        ht.Add(Convert.ToInt16(arr.GetValue(i)), arr.GetValue(i).ToString());
      return ht;
    }
  }
}

調(diào)用方式:

System.Collections.Hashtable arr = Comm.EnumHelper.EnumToHashtable(typeof(tImageFormat));
      foreach (string item in arr.Values)
        cb.Items.Add(item);

其中的cb表示ComboBox對象,你可以替換成你的下拉框?qū)ο蟆?/p>

上一篇:在Parallel中使用DbSet.Add()發(fā)現(xiàn)的一系列多線程問題和解決思路詳解

欄    目:C#教程

下一篇:使用C#語言實現(xiàn)的查詢條件界面展開和收起功能

本文標(biāo)題:c# EnumHelper枚舉常用操作類

本文地址:http://mengdiqiu.com.cn/a1/C_jiaocheng/6178.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有