/// <summary> /// Adds the specified property to the <see cref="NItemCollection"/>. /// </summary> /// <param name="property">The property to add.</param> public void AddProperty(INProperty property) { if (HasProperty(property)) { return; } property.SetParent(Owner); Add(property); OnPropertyAdded(new PropertyAddedEventArgs(this, property)); }
public PropertyValueChangedEventArgs ( [NotNull] INItemCollection collection, [NotNull] INProperty property, [CanBeNull] object oldValue, [CanBeNull] object newValue) : base( collection ) { Property = property; OldValue = oldValue; NewValue = newValue; }
/// <summary> /// Finds and returns a property with the specified name. /// </summary> /// <param name="propertyName">The name of the property to find.</param> /// <param name="result">The resulting property.</param> /// <returns><c>true</c> if the property was found; otherwise, <c>false</c>.</returns> public bool TryGetProperty(string propertyName, [CanBeNull] out INProperty result) { if (!TryGetItem(propertyName, out var item)) { result = null; return(false); } if (!(item is INProperty property)) { result = null; return(false); } result = property; return(true); }
/// <summary> /// Returns a value indicating whether the specified property exists. /// </summary> /// <param name="property">The property to find.</param> /// <returns><c>true</c> if the property was found; otherwise, <c>false</c>.</returns> public bool HasProperty(INProperty property) { return(HasProperty(property.Name)); }
public PropertyAddedEventArgs([NotNull] INItemCollection collection, [NotNull] INProperty property) : base(collection) { Property = property; }