Book Image

Learn C# Programming

By : Marius Bancila, Raffaele Rialdi, Ankit Sharma
5 (1)
Book Image

Learn C# Programming

5 (1)
By: Marius Bancila, Raffaele Rialdi, Ankit Sharma

Overview of this book

The C# programming language is often developers’ primary choice for creating a wide range of applications for desktop, cloud, and mobile. In nearly two decades of its existence, C# has evolved from a general-purpose, object-oriented language to a multi-paradigm language with impressive features. This book will take you through C# from the ground up in a step-by-step manner. You'll start with the building blocks of C#, which include basic data types, variables, strings, arrays, operators, control statements, and loops. Once comfortable with the basics, you'll then progress to learning object-oriented programming concepts such as classes and structures, objects, interfaces, and abstraction. Generics, functional programming, dynamic, and asynchronous programming are covered in detail. This book also takes you through regular expressions, reflection, memory management, pattern matching, exceptions, and many other advanced topics. As you advance, you'll explore the .NET Core 3 framework and learn how to use the dotnet command-line interface (CLI), consume NuGet packages, develop for Linux, and migrate apps built with .NET Framework. Finally, you'll understand how to run unit tests with the Microsoft unit testing frameworks available in Visual Studio. By the end of this book, you’ll be well-versed with the essentials of the C# language and be ready to start creating apps with it.
Table of Contents (20 chapters)

To get the most out of this book

This is a book that covers C#, from its building blocks to its most advanced features. This book is intended for people who want to learn C#. Therefore, we do not expect you to have any prior knowledge of the language. However, we do expect you to have some basic exposure to programming concepts, such as what a compiler is, the difference between compile time and runtime, the difference between stack and heap, and others.

All the code samples in this book have been written using C# 8 and a modern programming style (such as using expression-bodied members, interpolated strings, local functions, and so on). All these samples are available together with the book in projects targeting .NET Core 3.1.

The following table lists the software and platform requirements for running these samples:

In order to run the source code, you need Visual Studio 2019 16.3 or newer, any edition, or Visual Studio Code. Most of the samples can also be tested using an online compiler. Should you prefer this option, we recommend that you use https://sharplab.io/.

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying/pasting of code.