Exemple #1
0
        /// <summary>
        /// 获取参数值
        /// </summary>
        /// <typeparam name="TData"></typeparam>
        /// <param name="key"></param>
        /// <returns></returns>
        public TData GetData <TData>(string key)
        {
            VariableBase itemBase = null;

            if (m_ParamDic.TryGetValue(key, out itemBase))
            {
                Variable <TData> item = itemBase as Variable <TData>;
                return(item.Value);
            }
            else
            {
                return(default(TData));
            }
        }
Exemple #2
0
        /// <summary>
        /// 设置参数值
        /// </summary>
        /// <typeparam name="TData">泛型的类型</typeparam>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public void SetDate <TData>(string key, TData value)
        {
            VariableBase itemBase = null;

            if (m_ParamDic.TryGetValue(key, out itemBase))
            {
                Variable <TData> item = itemBase as Variable <TData>;
                item.Value      = value;
                m_ParamDic[key] = item;
            }
            else
            {
                //参数原来不存在
                Variable <TData> item = new Variable <TData>();
                item.Value      = value;
                m_ParamDic[key] = item;
            }
        }