/// <summary> /// Creates a CollectionSupport object with the contents specified in array. /// </summary> /// <param name="array">The array containing the elements used to populate the new CollectionSupport object.</param> /// <returns>A CollectionSupport object populated with the contents of array.</returns> public static CollectionSupport ToCollectionSupport(System.Object[] array) { CollectionSupport tempCollectionSupport = new CollectionSupport(); tempCollectionSupport.AddAll(array); return(tempCollectionSupport); }
/// <summary> /// Removes all the elements that aren't contained into the specified collection. /// </summary> /// <param name="collection">The collection used to verify the elements that will be retained.</param> /// <returns>Returns true if all the elements were successfully removed. Otherwise returns false.</returns> public virtual bool RetainAll(ICollection collection) { bool result = false; IEnumerator tempEnumerator = this.GetEnumerator(); CollectionSupport tempCollection = new CollectionSupport(); tempCollection.AddAll(collection); while (tempEnumerator.MoveNext()) { if (!tempCollection.Contains(tempEnumerator.Current)) { result = this.Remove(tempEnumerator.Current); if (result == true) { tempEnumerator = this.GetEnumerator(); } } } return(result); }
/// <summary> /// Removes all the elements that aren't contained into the specified collection. /// </summary> /// <param name="collection">The collection used to verify the elements that will be retained.</param> /// <returns>Returns true if all the elements were successfully removed. Otherwise returns false.</returns> public virtual bool RetainAll(System.Collections.ICollection collection) { bool result = false; System.Collections.IEnumerator tempEnumerator = this.GetEnumerator(); CollectionSupport tempCollection = new CollectionSupport(); tempCollection.AddAll(collection); while (tempEnumerator.MoveNext()) if (!tempCollection.Contains(tempEnumerator.Current)) { result = this.Remove(tempEnumerator.Current); if (result == true) { tempEnumerator = this.GetEnumerator(); } } return result; }
/// <summary> /// Creates a CollectionSupport object with the contents specified in array. /// </summary> /// <param name="array">The array containing the elements used to populate the new CollectionSupport object.</param> /// <returns>A CollectionSupport object populated with the contents of array.</returns> public static CollectionSupport ToCollectionSupport(System.Object[] array) { CollectionSupport tempCollectionSupport = new CollectionSupport(); tempCollectionSupport.AddAll(array); return tempCollectionSupport; }