コード例 #1
0
ファイル: EnumHelper.cs プロジェクト: qadir0108/EncorePiano
        public static IEnumerable <TextValuePair> GetEnumDescriptionValues(Type enumType)
        {
            var enums = new List <TextValuePair>();

            foreach (System.Enum item in System.Enum.GetValues(enumType))
            {
                var e = new TextValuePair()
                {
                    Text  = GetDescriptions(item).FirstOrDefault(),
                    Value = Convert.ToInt32(item).ToString()
                };
                enums.Add(e);
            }
            return(enums);
        }
コード例 #2
0
ファイル: EnumHelper.cs プロジェクト: qadir0108/EncorePiano
        public static IEnumerable <TextValuePair> GetEnumTextValues(Type enumType)
        {
            var enums = new List <TextValuePair>();

            foreach (System.Enum item in System.Enum.GetValues(enumType))
            {
                var e = new TextValuePair()
                {
                    Text  = System.Enum.GetName(enumType, item),
                    Value = Convert.ToInt32(item).ToString()
                };
                enums.Add(e);
            }
            return(enums);
        }