Category Results  

List<T> | IndexOf

IndexOf method is one of the methods of System.Collections.Generic. IndexOf method returns the index of the first item that equals to given item. If there are no items which equals to given item, it returns -1. IndexOf method has its overload methods. In the following examples, we will take a look at how IndexOf method […]

Read More
Collection

List<T> | GetRange

GetRange method is one of the methods of System.Collections.Generic. GetRange method returns a range for the current list. GetRange takes two parameters which are index and count. GetRange method returns items as given count parameter by starting index as given index parameter. That is all. Let’s take a look at the following example for better understanding.

Read More
Collection

List<T> | Finding Last Index | FindLastIndex

FindLastIndex method returns the index of the last item that meets the given condition. FindLastIndex method is one of the methods of System.Collections.Generic. If there are no items that meets the given condition, it returns -1. FindLastIndex  method has its overload methods. Let’s look at the following examples to see the how FindLastIndex methods work […]

Read More
Collection

List<T> | Finding Last Operator | FindLast

FindLast method is one of the methods of System.Collections.Generic. FindLast takes Predicate<T>  delegate as a parameter and returns the last item that meets the given condition. If there is no item that meets the given condition returns the default value of the type of the list. FindLast has no overload methods. It is so simple […]

Read More
Collection

List<T> | Finding Index Operator | FindIndex

FindIndex method is one of the methods of System.Collections.Generic. FindIndex method returns the index of the first item that meets the given condition. If there is no item that meets the given condition, it returns -1. FindIndex has its overload methods that takes parameters: Predicate delegate, int startIndex and int count. Usage of this methos […]

Read More
Collection

List<T> | Finding All Operator | FindAll

FindAll method is one of the methods of System.Collections.Generic. FindAll method retuns the all items of the list that meets the given condition. If there is no item that corresponding to the given condition, it returns the default value of the list’s type (Ex: default value of integer is zero and default value of string is null, etc.). FindAll method takes Predicate delegate as parameter. Let’s analyze the following code to make everything clear.

Read More
Collection

List<T> | Finding Operator | Find

Find method is one of the methods of System.Collections.Generic. Find method retuns the first item of the list that meets the given condition. If there is no item that corresponding to the given condition, it returns the default value of the list’s type (Ex: default value of integer is zero and default value of string is null, etc.). Find method takes Predicate delegate as parameter. Let’s analyze the following code to make everything clear.

Read More
Collection

List<T> | Existing Operator | Exists

Exists method is one of the methods of System.Collections.Generic. It returns true if the given condition exists in the list, otherwise it returns false. It takes Predicate class as a parameter. Let’s take a look at the following example for better understanding of the subject.   using System; using System.Collections.Generic; namespace ZeroToCSharp { class Program […]

Read More
Collection

List<T> | Array | CopyTo | Copy

Copy and CopyTo methods provides to copy that list or array to another one. When you assign or ship a list or array to another one, you just references it, not copy it since list and array are reference type values. So there are built-in functions(Copy and CopyTo) to copy these collections to another collection. Copy and CopyTo methods have overload methods and can differs about usage syntax. Here are a few samples about using Copy and CopyTo functions. Let’s look at he following example to make everything clear.

Read More
Collection

List<T> | Array | ConvertAll

ConvertAll is a method which provides user to convert type of all items of a collection (a list or an array) to another type. ConvertAll method can be used for a list or an array. Its using is so simple. Here is a few simple examples of using ConvertAll method for list and array. Let’s […]

Read More
Collection