Beispiel #1
0
 public SArray(Array array)
 {
     Values = new ISItem[array.Length];
     for (var i = 0; i < array.Length; i++)
     {
         Values[i] = SConvert.ToSettings(array.GetValue(i));
     }
 }
Beispiel #2
0
        // Set the property value by index.
        public override bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value)
        {
            if (typeof(long).IsAssignableFrom(indexes[0].GetType()))
            {
                Values[(long)indexes[0]] = SConvert.ToSettings(value);
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        // Get the property value by index.
        public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
        {
            if (typeof(long).IsAssignableFrom(indexes[0].GetType()))
            {
                result = SConvert.ToObject(Values[(long)indexes[0]]);
                return(true);
            }

            result = null;
            return(false);
        }
Beispiel #4
0
        public bool SetMember(string name, object value)
        {
            if (value == null && _properties.ContainsKey(name))
            {
                _properties.Remove(name);
            }
            else
            {
                _properties[name] = SConvert.ToSettings(value);
            }

            return(true);
        }
Beispiel #5
0
        public bool GetMember(string name, out object result)
        {
            // if the property doesn't exist, return null
            if (!_properties.ContainsKey(name))
            {
                result = null;
                return(true);
            }

            var value = _properties[name];

            result = SConvert.ToObject(value);

            return(true);
        }