System.Collections.List<T>
is used everywhere in C# code. Except for very special cases, it’s the replacement for arrays, linked lists, queues, and most other one-dimensional data structures. This is because it has all kinds of extra functionality, including the ability to grow in size on-demand. Today’s article wonders about how much performance is lost to gain this convenience and tests the List<T>
class against the lowly C# array: T[]
. How much performance are you giving up with List
and why is that happening? Read on to find out!
Posts Tagged list
Today’s article shows a class that helps clean up your foreach
loops when you want to call Add()
or Remove()
on the List
you’re looping over. Normally you’d get an exception, but today’s class works around that problem so your code is less error-prone and easier to read. It also discusses some workarounds you can use even if you don’t use SafeList
. Read on to learn how to make your foreach
loops less error-prone! UPDATE: SafeList 2.0 is out!