public object this[string key] { get { if (_innerValues.ContainsKey(key)) { return(_innerValues[key]); } var existing = RealProperties.FirstOrDefault(p => p.Name == key); if (existing == null) { return(null); } return(existing.GetValue(this, null)); } set { var existing = RealProperties.FirstOrDefault(p => p.Name == key); if (existing == null) { _innerValues[key] = value; } else { existing.SetValue(this, value, null); } } }
public bool Remove(string key) { if (_innerValues.ContainsKey(key)) { return(_innerValues.Remove(key)); } var existing = RealProperties.FirstOrDefault(p => p.Name == key); if (existing == null) { return(false); } existing.SetValue(this, null, null); return(true); }