C# Essential Training 1: Types and Control Flow
2h 48mBeginner2023-12-12
Authors

Matt Milner
Independent Consultant, Web Developer, Trainer
Course details
Do you need to learn the essentials of C#? This two-part series shows you through all the basics. In this course, part one of the series, instructor Matt Milner shows you classes, structs, variables, and much more. Matt begins by placing C# in context with .NET, MSIL, and the Base Class Library. He walks you through understanding and working with classes, structs, and records. Then Matt shows you several useful techniques to organize your C# code. He discusses variables in-depth, then dives into how to define, enable, and test enums, as well as how to use nullable types and work with null objects. Matt goes over if, else, and switch statements and covers switch expressions, the is expression, and an introduction to patterns. Plus, he explains several types of patterns and describes how to use guard conditions to further refine your switch case matches.
Skills covered
C#Programming FoundationsEssential TrainingProgramming LanguagesMicrosoftSoftware Development
Concepts
0. Introduction
- 01 - Explore the essentials
- 02 - What you should know
- 03 - CoderPad tour
1. C# in Context of .NET
- 04 - C# compiles to MSIL
- 05 - .NET runtime is responsible for running MSIL
- 06 - The base class library
- 07 - NuGet packages
- 08 - Compiling C# to a library or executable
2. Working with Classes, Structs, and Records
- 09 - Understanding classes, structs, and records
- 10 - Defining constructors
- 11 - Object initialization
- 12 - Initialize only properties
- 13 - Cloning and copying objects
- 14 - Equality comparisons
- 15 - Defining abstract classes
- 16 - Creating static classes
- 17 - Solution - Expressing equality
3. Organizing C# Code
- 18 - Using namespaces to organize code
- 19 - Referencing .NET assemblies
- 20 - Applying access modifiers
- 21 - Aliasing namespaces for clarity
4. Variables Revisited
- 22 - Declaring variables using types
- 23 - Using the var keyword
- 24 - Working with anonymous types
- 25 - Using dynamic variables
- 26 - Solution - Dynamic keyword
5. Working with Enums and Nullables
- 27 - Defining enums
- 28 - Enabling multiple enum values
- 29 - Testing enum values
- 30 - Understanding nullable types
- 31 - Using nullable types
- 32 - Working with null objects
- 33 - Understanding nullable reference types
- 34 - Working with nullable reference types
- 35 - Solution - Enum Flags
6. Using Patterns in Control Flow
- 36 - If and switch revisited
- 37 - Switch statement vs. switch expression
- 38 - Using the is expression
- 39 - Introduction to patterns
- 40 - Constant, relational, and logical patterns
- 41 - Property pattern
- 42 - Guard conditions
- 43 - Solution - Switch expression using patterns
Conclusion
- 44 - Learn more and build something