/// <summary> /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1" />. /// </summary> /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1" />.</param> /// <exception cref="T:System.NotSupportedException"> /// The <see cref="T:System.Collections.Generic.ICollection`1" /> is /// read-only. /// </exception> public void Add(IComponentChannel item) { if (Contains(item)) { throw new InvalidOperationException("Channel with the same name already exists"); } _channels.Add(item); }
/// <summary> /// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1" /> contains a specific value. /// </summary> /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1" />.</param> /// <returns> /// <see langword="true" /> if <paramref name="item" /> is found in the /// <see cref="T:System.Collections.Generic.ICollection`1" />; otherwise, <see langword="false" />. /// </returns> public bool Contains(IComponentChannel item) { return(_channels.Contains(item)); }
/// <summary> /// Removes the first occurrence of a specific object from the /// <see cref="T:System.Collections.Generic.ICollection`1" />. /// </summary> /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1" />.</param> /// <returns> /// <see langword="true" /> if <paramref name="item" /> was successfully removed from the /// <see cref="T:System.Collections.Generic.ICollection`1" />; otherwise, <see langword="false" />. This method also /// returns <see langword="false" /> if <paramref name="item" /> is not found in the original /// <see cref="T:System.Collections.Generic.ICollection`1" />. /// </returns> /// <exception cref="T:System.NotSupportedException"> /// The <see cref="T:System.Collections.Generic.ICollection`1" /> is /// read-only. /// </exception> public bool Remove(IComponentChannel item) { return(_channels.Remove(item)); }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <param name="other">An object to compare with this object.</param> /// <returns> /// <see langword="true"/> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <see langword="false"/>. /// </returns> public bool Equals(IComponentChannel other) { return(other != null && Name.Equals(other.Name)); }