Chapter 22. Lists and Arrays

This chapter covers two important types of collections available to you in C#. These collections enable you to act on several things as a group. For example, you could loop over a List of GameObjects each frame to update all of their positions and states.

By the end of this chapter, you will understand how these collection types work and which to use in various situations.

C# Collections

A collection is a group of objects that are referenced by a single variable. In regular life, collections would be things like a group of people, a pride of lions, a parliament of rooks, or a murder of crows. In C#, there are two important types of collections for you to understand:

Array: Arrays are the most primitive but fastest ...

Get Introduction to Game Design, Prototyping, and Development: From Concept to Playable Game with Unity and C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.