O'Reilly logo

C# Data Structures and Algorithms by Marcin Jamro

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

Generic list

As you can see, the ArrayList class contains a broad range of features, but it has a significant drawback—it is not a strongly typed list. If you want to benefit from a strongly typed list, you can use the generic List class representing the collection, whose size can be increased or decreased, whenever necessary.

The generic List class contains many properties and methods that are very useful while developing applications that store data. You will see that many members are named exactly the same as in the ArrayList class, such as Count and Capacity properties, as well as the Add, AddRange, Clear, Contains, IndexOf, Insert, InsertRange, LastIndexOf, Remove, RemoveAt, RemoveRange, Reverse, and ToArray methods. You can also get ...

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