1. 程式人生 > >將英文列表轉成中文

將英文列表轉成中文

定義英文列舉

enum Week
        {
            Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
        }

定義轉換方法

static string GetChineseWeek(Week week)
        {
            string[] chineseWeek = { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日" };
            return chineseWeek[(int)week];

        }

呼叫

string ss=GetChineseWeek(Week.Friday)