BrandGhost
UNEXPECTED 87% Performance Boost! - C# Collection Initializers

UNEXPECTED 87% Performance Boost! - C# Collection Initializers

In C#, we have multiple ways that we can create collections. We have collection initializers in C# as well as collection expressions in C# - both of which create new collections with items in them. But have you ever wondered about the performance of these two? Let's use BenchmarkDotNet to performance profile our C# code and see if collection expressions have different behavior!
An error has occurred. This application may no longer respond until reloaded. Reload