public T GetValue <T>(string propertyName) { PropertyDictionaryEntry entry; if (!propertyDictionary.TryGetValue(propertyName, out entry)) { entry = new PropertyDictionaryEntry(typeof(T), default(T)); propertyDictionary.Add(propertyName, entry); } return((T)entry.Value); }
public void SetValue <T>(string propertyName, T value) { T oldValue; PropertyDictionaryEntry entry; if (!propertyDictionary.TryGetValue(propertyName, out entry)) { entry = new PropertyDictionaryEntry(typeof(T), default(T)); propertyDictionary.Add(propertyName, entry); } oldValue = (T)entry.Value; entry.Value = value; foreach (PropertyChanged handler in entry.ChangeHandlers) { handler(oldValue, value); } }