O'Reilly logo

.NET 4.0 Generics by Sudipta Mukherjee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Performance Cheat Sheet

List<T>

Methods

Complexity (for n elements and count m)

Add

O(1)

AddRange

O(n + m)

AsReadOnly

O(1)

BinarySearch

O(log n)

Clear

O(n)

Contains

O(n)

ConvertAll

O(n)

CopyTo

O(n)

Exists

O(n)

Find

O(n)

FindAll

O(n)

FindIndex

O(n)

ForEach

O(n)

GetRange

O(n)

IndexOf

O(n)

Insert

O(n)

InsertRange

O(n + m)

LastIndexOf

O(n)

RemoveAll

O(n)

RemoveAt

O(n)

RemoveRange

O(n)

Reverse

O(n)

Sort

O(n log n)

ToArray

O(n)

TrimExcess

O(n)

TrueForAll

O(n)

Stack<T>

Methods

Complexity (for n elements)

Clear

O(n)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required