Welcome to the next unit of this course!
Before we get deeper into C# essentials for interview prep, we'll remind ourselves about some C# features — specifically, C# collections like arrays
and strings
. These collections allow C# to group multiple elements, such as numbers or characters, under a single entity.
Some of these concepts might already be familiar to you, so you can breeze through the beginning until we get to the meat of the course and the path.
As our starting point, it's crucial to understand what C# collections are. They help us manage multiple values efficiently and are categorized into Arrays
, Dictionaries
, and more.
We will focus mainly on arrays and strings in C#.
Arrays in C# are fixed-size collections, meaning once an array is defined, its size cannot be changed directly. However, you can use methods like Array.Resize()
to create a new array with a different size while preserving the elements of the original array, or manually copy elements with Array.Copy()
. While the size is fixed, the array itself is mutable, allowing you to modify its individual elements after creation.
On the other hand, strings in C# are immutable, meaning once a string is created, it cannot be changed. Any operations that seem to modify a string, such as concatenation or replacing characters, actually result in the creation of a new string object in memory.
