Skip to content

Tag Archives: CSharp-Collections.ObjectModel-Namespace

Collection<T>.GetEnumerator Method is used to get an enumerator that iterates through the Collection<T>. Syntax: public System.Collections.Generic.IEnumerator<T> GetEnumerator (); Return Value: This method returns an IEnumerator<T>… Read More
Collection<T> Class provides the base class for a generic collection. Here T is the type of elements in the collection. This class comes under the… Read More
Collection<T>.Item[Int32] property is used to get or set the element at the specified index. Syntax: public T this[int index] { get; set; } Here, index… Read More
Collection<T>.IndexOf(T) method is used to search for the specified object and returns the zero-based index of the first occurrence within the entire Collection<T>. Syntax: public… Read More
Collection<T>.Add(T) method is used to add an object to the end of the Collection<T>. Syntax : public void Add (T item); Here, item is the… Read More
Collection<T>.Clear method is used to remove all elements from the Collection<T>. Syntax: public void Clear (); Below given are some examples to understand the implementation… Read More
Collection<T>.CopyTo(T[], Int32) method is used to copy the entire Collection<T> to a compatible one-dimensional Array, starting at the specified index of the target array. Syntax:… Read More
Collection<T>.Count property is used to get the number of elements actually contained in the Collection<T>. Syntax: public int Count { get; } Return Value: The… Read More
Collection<T>.RemoveAt(Int32) is used to remove the element at the specified index of the Collection<T>. Syntax: public void RemoveAt (int index); Here, index is the zero-based… Read More
Collection<T>.Insert(Int32, T) method is used to insert an element into the Collection<T> at the specified index. Syntax: public void Insert (int index, T item); Parameters:… Read More
Collection<T>.Contains(T) method is used to determine whether an element is in the Collection<T>. Syntax: public bool Contains (T item); Here, item is the object to… Read More
Collection<T>.Remove(T) is used to remove the first occurrence of a specific object from the Collection<T>. Syntax: public bool Remove (T item); Here, item is the… Read More

Start Your Coding Journey Now!