Collection Performance: Creating new collection From a collection Using AddRange()

Its common in programming to create a collection from a collection. Usually there is some business logic applied to the items before they are put into the new collection. This article will focus on doing that by using AddRange() from LINQ.

Collection Performance: Creating A New List Or Linkedlist While Adding Items Using The Constructor

In many of the collection types in .NET, you can fill a collection at the same time the object is created as that can improve performance. This article shows the performance results for List and LinkedList.

Collection Performance: Sort() with CompareTo()

Let’s discuss for() and foreach() under load to establish a baseline. As you can see below, I used the same code in the previous chapter and added Task.Delay() to simulate a CPU load.

Collection Performance: Creating New Collection From A Collection Using for() & foreach()

It's common in programming to create a collection from a collection using for(), foreach() and ForEach(). Usually, business logic is applied to the items before they are put into the new collection. This article will focus on doing that along with discussing capacity. Updated February 2023.

Collection Performance Under Load: for() and foreach()

Let’s discuss for() and foreach() under load to establish a baseline. As you can see below, I used the same code in the previous chapter and added Task.Delay() to simulate a CPU load.

Collection Performance: Looping Over a Collection

There are four main ways to loop through a collection by using for(), foreach(), do() and while(). Let’s see which one of these methods are the most performant along with using the generic ForEach() method. Updated September 2023.