Esempio n. 1
0
        public virtual void SetValue(ParameterProperty property, object value)
        {
            if (!property.IsValidValue(value))
            {
                throw new ArgumentException("值类型不匹配");
            }
            Type   type = GetType();
            string key  = property.CreateKey(type);

            m_DicValue[key] = value;
        }
Esempio n. 2
0
        public static ParameterProperty Register(Type ownertype, string name, Type valueType, object defaultValue)
        {
            ParameterProperty property = new ParameterProperty();

            property.Name      = name;
            property.OwerType  = ownertype;
            property.ValueType = valueType;
            if (property.CheckedKey())
            {
                throw new ArgumentException("该名称属性已经被注册");
            }
            if (!property.IsValidValue(defaultValue))
            {
                throw new ArgumentException("默认值类型不匹配");
            }
            string key = property.CreateKey(ownertype);

            m_DicDefault[key] = defaultValue;
            return(property);
        }