コード例 #1
0
        /// <summary>
        /// 获取自定义枚举特性描述(传输描述位置)
        /// </summary>
        /// <param name="enumSubitem"></param>
        /// <param name="text"></param>
        /// <param name="pos"></param>
        public static void GetSelfAttributeInfo(Enum enumSubitem, out string text, int pos)
        {
            Object obj = GetAttributeClass(enumSubitem, typeof(SelfAttribute));

            if (obj == null)
            {
                text = enumSubitem.ToString();
            }
            else
            {
                SelfAttribute da = (SelfAttribute)obj;
                if (pos == 1)
                {
                    text = da.DisplayText1;
                }
                else if (pos == 2)
                {
                    text = da.DisplayText2;
                }
                else
                {
                    text = da.DisplayText1;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取自定义枚举特性描述
        /// </summary>
        /// <param name="enumSubitem"></param>
        /// <param name="text1"></param>
        /// <param name="text2"></param>
        public static void GetselfAttributeInfo(Enum enumSubitem, out string text1, out string text2)
        {
            Object obj = GetAttributeClass(enumSubitem, typeof(SelfAttribute));

            if (obj == null)
            {
                text1 = text2 = enumSubitem.ToString();
            }
            else
            {
                SelfAttribute da = (SelfAttribute)obj;
                text1 = da.DisplayText1;
                text2 = da.DisplayText2;
            }
        }