<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      ENUM幫助類

       

      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Collections;
      using System.Reflection;

      namespace CommonFunction
      {
      public class EnumClass
      {
      private static object refLock = new object();
      private static EnumClass instance=null;

      public static EnumClass Instance
      {
      get {
      lock (refLock)
      {
      if (instance == null)
      {
      lock (refLock)
      {
      instance
      = new EnumClass();
      }
      }
      }
      return instance;
      }
      }


      /// <summary>
      /// 獲取指定枚舉類型的鍵值對集合
      /// </summary>
      /// <param name="type">枚舉類型</param>
      /// <returns></returns>
      public Hashtable GetKeysAndValues(Type type)
      {
      if (!CheckType(type))
      {
      return null;
      }

      Hashtable list
      = new Hashtable();
      foreach (string key in Enum.GetNames(type))
      {
      string val=Enum.Format( type, Enum.Parse(type, key), "d");
      list.Add(key,val);
      }

      return list;
      }


      /// <summary>
      /// 獲取枚舉類型元素集合
      /// </summary>
      /// <param name="type">枚舉類型</param>
      /// <returns></returns>
      public Array GetKeys(Type type)
      {
      if (!CheckType(type))
      {
      return null;
      }

      //檢索指定枚舉中常數值的數組
      return Enum.GetValues(type);
      }


      /// <summary>
      /// 檢驗枚舉類型
      /// </summary>
      /// <param name="type">類型</param>
      /// <returns></returns>
      private bool CheckType(Type type)
      {
      if (type == null)
      {
      return false;
      }

      if (!type.IsEnum)
      {
      throw new Exception(type.FullName + "不是枚舉類型");
      }

      return true;
      }


      /// <summary>
      /// 獲取枚舉類型值集合
      /// </summary>
      /// <param name="type">枚舉類型</param>
      /// <returns></returns>
      public List<int> GetValues(Type type)
      {
      Array array
      = GetKeys(type);
      List
      <int> list = new List<int>();
      foreach (object obj in array)
      {
      list.Add((
      int)obj);
      }

      return list;
      }

      }
      }

      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Collections;

      namespace CommonFunction
      {
      class Program
      {
      enum Days { Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6 };
      static void Main(string[] args)
      {
      Hashtable hashtable
      = EnumClass.Instance.GetKeysAndValues(typeof(Days));
      Console.WriteLine(
      "---------枚舉類型鍵值對---------");
      foreach (DictionaryEntry de in hashtable)
      {
      Console.WriteLine(de.Key
      +" = "+de.Value);
      }
      Console.WriteLine();

      Console.WriteLine(
      "---------枚舉類元素---------");
      Array array
      = EnumClass.Instance.GetKeys(typeof(Days));
      foreach (Days day in array)
      {
      Console.WriteLine(day);
      }
      Console.WriteLine();

      Console.WriteLine(
      "---------枚舉類值---------");
      List
      <int> list = EnumClass.Instance.GetValues(typeof(Days));
      foreach (int i in list)
      {
      Console.WriteLine(i);
      }
      Console.ReadLine();
      }
      }
      }
      posted @ 2011-03-03 08:47  古文觀芷  閱讀(677)  評論(1)    收藏  舉報
      主站蜘蛛池模板: 精品国产一区二区三区久久女人| 久久九九精品99国产精品| 成人精品视频一区二区三区| 国产亚洲av夜间福利香蕉149| 国产午夜亚洲精品不卡下载| 墨江| 在线观看中文字幕国产码| 好爽毛片一区二区三区四| 东京热一精品无码av| 国产午夜精品福利91| 色老头亚洲成人免费影院| 中文字幕有码无码AV| 在线aⅴ亚洲中文字幕| 国产成人亚洲老熟女精品| 国产精品99一区二区三区| 亚洲精品成人区在线观看| 亚洲精品一区二区三区不| 色噜噜噜亚洲男人的天堂| 欧美福利电影A在线播放| 激情国产一区二区三区四区| 欧美成人aaa片一区国产精品| 亚洲成av人片无码天堂下载| 激情综合网激情五月激情| gogogo高清在线播放免费| 久久国内精品自在自线91| 国产情侣激情在线对白| 国产在线无码精品无码| 亚洲中文精品一区二区| 欧美极品色午夜在线视频 | 一区二区三区激情都市| 四虎成人在线观看免费| 黑人巨大av无码专区| free性开放小少妇| 国产一区二区三区日韩精品| 麻豆精品久久精品色综合| 欧美成人www免费全部网站 | 久久精品一区二区日韩av| 亚洲国产欧美一区二区好看电影| 人妻丝袜AV中文系列先锋影音| 久久成人 久久鬼色| 欧美国产精品不卡在线观看|