Skip to content

Tag Archives: CSharp-Generic-List

We have given a integer array arr and the task is to convert integer array into the list lst in C#. In order to do this task,… Read More
In C#, List is a generic collection which is used to store the elements or objects in the form of a list and it is… Read More
List<T>.FindIndex Method is used to search for an element that matches the conditions defined by a specified predicate and returns the index of the first… Read More
List<T>.Sort() Method is used to sort the elements or a portion of the elements in the List<T> using either the specified or default IComparer<T> implementation… Read More
List<T>.Sort() Method is used to sort the elements or a portion of the elements in the List<T> using either the specified or default IComparer<T> implementation… Read More
This method is used to search for an element which matches the conditions defined by a specified predicate and returns the zero-based index of the… Read More
List<T>.BinarySearch() Method uses a binary search algorithm to locate a specific element in the sorted List<T> or a portion of it. There are 3 methods… Read More
This method is used to search for an element which matches the conditions defined by a specified predicate and returns the zero-based index of the… Read More
List<T>.AsReadOnly Method is used to get a read-only ReadOnlyCollection<T> wrapper for the current collection. Syntax: public System.Collections.ObjectModel.ReadOnlyCollection<T> AsReadOnly (); Return Value: It returns an object… Read More
Equals(Object) Method which is inherited from the Object class is used to check if a specified List<T> object is equal to another List<T> object or… Read More
List<T>.AsReadOnly Method is used to get a read-only ReadOnlyCollection<T> wrapper for the current collection. Syntax: public System.Collections.ObjectModel.ReadOnlyCollection AsReadOnly (); Return Value: It returns an object… Read More
List<T>.TrueForAll(Predicate<T>) is used to check whether every element in the List<T> matches the conditions defined by the specified predicate or not. Syntax: public bool TrueForAll… Read More
List<T>.GetEnumerator Method is used to returns an enumerator that iterates through the List<T>. Syntax: public System.Collections.Generic.List<T>.Enumerator GetEnumerator (); Return Value: It returns an List<T>Enumerator for… Read More
List<T>.TrimExcess Method is used to set the capacity to the actual number of elements in the List<T>, if that number is less than a threshold… Read More
List<T> class represents the list of objects which can be accessed by index. It comes under the System.Collection.Generic namespace. List class can be used to… Read More