---
title: "Quick one: Difference between collection expressions and collection initializer"
description: "\nDid you ever wonder if there is a noticeable difference between:\n\n```csharp\nList<int> a = [1, 2, 3];\n// And\nList<int> b = new() {1,2,3};\n```\n\nLet's find out:"
updated: 2025-08-25
tags: [".NET", "Collections", "Performance"]
canonical: "https://steven-giesel.com/blogPost/fea0b033-ccf5-4197-b62c-ffd8ca6d79c7/quick-one-difference-between-collection-expressions-and-collection-initializer"
---

# Quick one: Difference between collection expressions and collection initializer


Did you ever wonder if there is a noticeable difference between:

```csharp
List<int> a = [1, 2, 3];
// And
List<int> b = new() {1,2,3};
```

Let's find out:

## Lowered version
We can make the answer pretty obvious, so we just [lower](https://steven-giesel.com/blogPost/69dc05d1-9c8a-4002-9d0a-faf4d2375bce/c-lowering) the [code](https://sharplab.io/#v2:D4AQDABCCMAsDcBYAUCgMgSwM4BcA8GAdjgHwQCGEAvBANrQA0ATAwMwC6SymuBxZAI2oRCAUwDuACgCUEAN6MWrAL7wgA==):

```csharp
int num = 3;
List<int> list = new List<int>(num);
CollectionsMarshal.SetCount(list, num);
Span<int> span = CollectionsMarshal.AsSpan(list);
int num2 = 0;
span[num2] = 1;
num2++;
span[num2] = 2;
num2++;
span[num2] = 3;
num2++;
List<int> list2 = new List<int>();
list2.Add(1);
list2.Add(2);
list2.Add(3);
```

Where `list` is our `a` and `list2` is `b`. So collections expressions (`[1,2,3]`) are "smarter" and faster in the sense that they preallocate the list with the exact number of elements we want to add. The collection initializer doesn't do that for one simple reason: The compiler by its spec is required to call the `Add` method for each element in the initializer. Is the performance benefit worth it? Well that is up to you - it is measurable for sure!