コード例 #1
0
        public override void SetValue <TValue>(string name, TValue value)
        {
            DynamicProperty <TValue> property = GetProperty <TValue>(name);

            if (property != null)
            {
                property.Value = value;
            }
        }
コード例 #2
0
        public override void AddProperty <TValue>(string name, DynamicProperty <TValue> property)
        {
            if (HasProperty(name))
            {
                throw new InvalidOperationException(String.Format("Can't add property {0}, because it is already added.", name));
            }

            Properties.Add(name, property);
        }
コード例 #3
0
        // public methods...
        public override TValue GetValue <TValue>(string name)
        {
            DynamicProperty <TValue> property = GetProperty <TValue>(name);

            if (property != null)
            {
                return(property.Value);
            }
            return(default(TValue));
        }
コード例 #4
0
        public override DynamicProperty <TValue> GetProperty <TValue>(string name)
        {
            if (!HasProperty(name))
            {
                throw new InvalidOperationException(String.Format("Can't get property {0} value, because it doesn't exist.", name));
            }

            DynamicProperty <TValue> property = Properties[name] as DynamicProperty <TValue>;

            if (property == null)
            {
                throw new InvalidOperationException(String.Format("Invalid type {0} specified for {1} property.", typeof(TValue).FullName, name));
            }

            return(property);
        }
コード例 #5
0
 public override void AddProperty <TValue>(string name, DynamicProperty <TValue> property)
 {
     throw new InvalidOperationException("Can't add child properties to SimpleProperty instance.");
 }