Example 1: Returns the first occurrence of item matching the specified predicate. C# using System;...
Category - List
List Equals in C# Examples
Example1: Returns true if the two specified lists are reference equal (are the same instance). C#...
Copy List Elements to Array using CopyTo Method in C#
Copies all list items into the beginning of the specified array. Using: C# list.CopyTo(arr); 1 list...
C# Copy List Without Reference
In this example, I will show you how to copy a list items without using references. Been looking...
List ConvertAll Method in C#
Converts items using specified delegate. Items can be converted to another type. Using: C# var conv...
How to check whether a List contains a specified element in C#
Returns true if the list contains the specified item. Using: C# bool result = list.Contains(3); 1...
How to empty a list in C#
Removes all items from the list. Count is zero, Capacity is unchanged. Using: C# list.Clear(); 1...
C# list BinarySearch Example
Binary Search Examples in C# Returns the zero-based index of the item in the sorted list. If the...
What is the AddRange method in C# List
Adds items of another list (or an IEnumerable collection) to the end of the list. Using AddRange...
Add new item to List in C#
The Add method of the List object adds an element to the end of the list. Here is the example: C#...