chapter five

5 C# Collections & Iterators

 

This chapter covers

  • The definition of an Array in C#
  • Declaring an Array and its various types
  • Using Array methods and properties
  • The definition of a Collection in C#
  • Declaring a Collection and its various types
  • Using Collection methods and properties
  • The shared System.Linq namespace
  • The definition of a Loop and an iterator in C#
  • Declaring Loops and Iterators and their various types
  • Development process of a Tic Tac Toe minigame

With this fifth chapter, we finally reached the end of the introductory portion of this tiny c# projects manuscript. Until now, we learned everything about C# as a utility, medium, and tool. From the technology stack behind to the individual components that make this language. We learned programming basics and built a project on each step throughout our journey.

With this final step, we will get comfortable with the last programming basics essential to any application and set up the most extensive and feature-richest project so far.

In this chapter, we will create an application famous for its seemingly simple appearance but surprisingly complicated code, the well-known Tic-Tac-Toe minigame.

This project entails the need to master much more than what we worked on until now. This time, apart from variables, conditionals, console methods, and operators, we also need to step towards arrays, collections, and iterators. Even a simple AI is needed not to obligate the user to include a second player.

5.1 Arrays in C#

5.1.1 The definition of an array

5.1.2 Declaring arrays

5.1.3 Types of arrays

5.1.4 Array properties and methods

5.2 Collections in C#

5.2.1 The definition of a collection

5.2.2 System.Collections classes

5.2.3 System.Collections.Concurrent classes

5.2.4 System.Collections.Generic classes

5.2.5 Collection properties and methods

5.2.6 Differences between array and collection

5.2.7 The shared System.Linq namespace

5.3 Iteration statements in C#

5.3.1 Loops and Iterators

5.3.2 Types of Iterators and loops in C#