コード例 #1
0
        private object AutoConvert(EnumDescriptionAttribute attribute, int p)
        {
            if (!string.IsNullOrEmpty(attribute.FullDescription) && attribute.FullDescription.Length <= p)
            {
                return(attribute.FullDescription);
            }

            if (!string.IsNullOrEmpty(attribute.LitteralDescription) && attribute.LitteralDescription.Length <= p)
            {
                return(attribute.LitteralDescription);
            }

            return(attribute.ShortDescription);
        }
コード例 #2
0
        private object ManualConvert(EnumTypeDescription typeDesc, EnumDescriptionAttribute attribute)
        {
            switch (typeDesc)
            {
            case EnumTypeDescription.Litteral:
                return(attribute.LitteralDescription);

            case EnumTypeDescription.Full:
                return(attribute.FullDescription);

            case EnumTypeDescription.Icon:
                return(attribute.Icon);

            default:
                return(attribute.ShortDescription);
            }
        }