Пример #1
0
        /// <summary>
        /// 获取说明
        /// </summary>
        /// <param name="caption"></param>
        /// <param name="field"></param>
        /// <returns></returns>
        public Caption GetCaption(string caption, string field)
        {
            string name = caption;

            if (string.IsNullOrWhiteSpace(name))
            {
                name = field;
            }
            Caption result = new Caption()
            {
                Name  = name,
                Value = name,
                Hint  = name
            };

            if (string.IsNullOrWhiteSpace(name))
            {
                return(result);
            }
            if (this.captionDic.ContainsKey(name.ToLower()))
            {
                this.captionDic.TryGetValue(name.ToLower(), out result);
                return(result);
            }
            else
            {
                AddCaption(result);
                return(result);
            }
        }
Пример #2
0
        /// <summary>
        /// 添加说明
        /// </summary>
        /// <param name="caption"></param>
        public void AddCaption(Caption caption)
        {
            string key = caption.Name.ToLower();

            if (captionDic.ContainsKey(key))
            {
                return;
            }
            captionDic.Add(key, caption);
        }