This CSharp 輔助用法


namespace ThisClass
{
    public enum EThisC
    {
        ET_A,
        ET_B,
        ET_C
    }
    /// 輔助類 
    public static class EThisCFunc
    {
        public static string ToMyString(this EThisC et)
        {
            switch(et)
            {
                case EThisC.ET_A:
                    return "ET_AAAAA";
                case EThisC.ET_B:
                    return "ET_BBBB";
                default:
                    return "ET_NNNN";
            }
        }
    }


    class Program
    {
        static void Main(string[] args)
        {
            System.Console.WriteLine(EThisC.ET_A.ToMyString());
            System.Console.ReadKey();
        }
    }

發佈了20 篇原創文章 · 獲贊 1 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章