/// <summary> /// Determines whether the <see cref="T:System.Collections.Generic.IDictionary`2"/> contains an element with the specified key. /// </summary> /// <returns> /// true if the <see cref="T:System.Collections.Generic.IDictionary`2"/> contains an element with the key; otherwise, false. /// </returns> /// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.IDictionary`2"/>.</param> /// <exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.</exception> public bool ContainsKey(TKey key) { if (key == null) { throw new ArgumentNullException("key"); } return(_data.ContainsKey(key)); }
/// <summary> /// Registers a callback to call when a specified property changes. /// </summary> /// <param name="property">The property to monitor.</param> /// <param name="handler">The method to call when the property changes.</param> public void AddPropertyChangedHandler(ModelProperty property, EventHandler <ModelPropertyChangedEventArgs> handler) { lock (_lockObject) { List <WeakAction <object, ModelPropertyChangedEventArgs> > handlers; if (!_propertyChangedHandlers.TryGetValue(property.Key, out handlers)) { handlers = new List <WeakAction <object, ModelPropertyChangedEventArgs> >(); _propertyChangedHandlers = _propertyChangedHandlers.AddOrUpdate(property.Key, handlers); } handlers.Add(new WeakAction <object, ModelPropertyChangedEventArgs>(handler.Method, handler.Target)); } var uninitializedValue = property.DefaultValue as ModelProperty.UnitializedValue; if (uninitializedValue != null && !_values.ContainsKey(property.Key)) { var value = uninitializedValue.GetValue(this); SetValueCore(property, value); } }
/// <summary> /// Determines whether the collection contains the specified item. /// </summary> public bool Contains(T item) { return(_items.ContainsKey(item)); }