Book description
Publisher’s Note: Microsoft stopped supporting .NET 5 in May 2022. The newer 8th edition of the book is available that covers .NET 8 (end-of-life November 2026) with C# 12 and EF Core 8. Purchase of the print or Kindle book includes a free PDF eBook
Key Features
- Explore the newest additions to C# 9, the .NET 5 class library, Entity Framework Core and Blazor
- Strengthen your command of ASP.NET Core 5.0 and create professional websites and services
- Build cross-platform apps for Windows, macOS, Linux, iOS, and Android
Book Description
In C# 9 and .NET 5 – Modern Cross-Platform Development, Fifth Edition, expert teacher Mark J. Price gives you everything you need to start programming C# applications.
This latest edition uses the popular Visual Studio Code editor to work across all major operating systems. It is fully updated and expanded with a new chapter on the Microsoft Blazor framework.
The book’s first part teaches the fundamentals of C#, including object-oriented programming and new C# 9 features such as top-level programs, target-typed new object instantiation, and immutable types using the record keyword. Part 2 covers the .NET APIs, for performing tasks like managing and querying data, monitoring and improving performance, and working with the file system, async streams, serialization, and encryption. Part 3 provides examples of cross-platform apps you can build and deploy, such as websites and services using ASP.NET Core or mobile apps using Xamarin.Forms. The best type of application for learning the C# language constructs and many of the .NET libraries is one that does not distract with unnecessary application code. For that reason, the C# and .NET topics covered in Chapters 1 to 13 feature console applications. In Chapters 14 to 20, having mastered the basics of the language and libraries, you will build practical applications using ASP.NET Core, Model-View-Controller (MVC), and Blazor.
By the end of the book, you will have acquired the understanding and skills you need to use C# 9 and .NET 5 to create websites, services, and mobile apps.
What you will learn
- Build your own types with object-oriented programming
- Query and manipulate data using LINQ
- Build websites and services using ASP.NET Core 5
- Create intelligent apps using machine learning
- Use Entity Framework Core and work with relational databases
- Discover Windows app development using the Universal Windows Platform and XAML
- Build rich web experiences using the Blazor framework
- Build mobile applications for iOS and Android using Xamarin.Forms
Who this book is for
This book is best for C# and .NET beginners, or programmers who have worked with C# in the past but feel left behind by the changes in the past few years. This book doesn’t expect you to have any C# or .NET experience; however, you should have a general understanding of programming. Students and professionals with a science, technology, engineering, or mathematics (STEM) background can certainly benefit from this book.
Table of contents
- Preface
-
Hello, C#! Welcome, .NET!
-
Setting up your development environment
- Using Visual Studio Code for cross-platform development
- Using GitHub Codespaces for development in the cloud
- Using Visual Studio 2019 for Windows app development
- Using Visual Studio for Mac for mobile development
- Recommended tools for chapters
- Deploying cross-platform
- Understanding Microsoft Visual Studio Code versions
- Downloading and installing Visual Studio Code
- Installing other extensions
-
Understanding .NET
- Understanding .NET Framework
- Understanding the Mono and Xamarin projects
- Understanding .NET Core
- Understanding .NET 5 and the journey to one .NET
- Understanding .NET support
- Understanding .NET Runtime and .NET SDK versions
- Removing old versions of .NET
- What is different about .NET Core and .NET 5?
- Understanding .NET Standard
- .NET platforms and tools used by the book editions
- Understanding intermediate language
- Comparing .NET technologies
- Building console apps using Visual Studio Code
- Downloading solution code from the GitHub repository
- Looking for help
- Practicing and exploring
- Summary
-
Setting up your development environment
-
Speaking C#
- Introducing C#
- Understanding C# basics
- Working with variables
- Working with null values
- Exploring console applications further
- Practicing and exploring
- Summary
-
Controlling Flow and Converting Types
- Operating on variables
- Understanding selection statements
- Understanding iteration statements
- Casting and converting between types
- Practicing and exploring
- Summary
- Writing, Debugging, and Testing Functions
-
Building Your Own Types with Object-Oriented Programming
- Talking about object-oriented programming
- Building class libraries
-
Storing data within fields
- Defining fields
- Understanding access modifiers
- Setting and outputting field values
- Storing a value using an enum type
- Storing multiple values using an enum type
- Storing multiple values using collections
- Making a field static
- Making a field constant
- Making a field read-only
- Initializing fields with constructors
- Setting fields with default literals
- Writing and calling methods
- Controlling access with properties and indexers
- Pattern matching with objects
- Working with records
- Practicing and exploring
- Summary
-
Implementing Interfaces and Inheriting Classes
- Setting up a class library and console application
- Simplifying methods
- Raising and handling events
- Implementing interfaces
- Making types safely reusable with generics
- Managing memory with reference and value types
- Inheriting from classes
- Casting within inheritance hierarchies
- Inheriting and extending .NET types
- Practicing and exploring
- Summary
-
Understanding and Packaging .NET Types
- Introducing .NET 5
- Understanding .NET components
- Publishing your applications for deployment
- Decompiling assemblies
- Packaging your libraries for NuGet distribution
- Porting from .NET Framework to .NET 5
- Practicing and exploring
- Summary
-
Working with Common .NET Types
- Working with numbers
- Working with text
- Pattern matching with regular expressions
- Storing multiple objects in collections
- Working with spans, indexes, and ranges
- Working with network resources
- Working with types and attributes
- Working with images
- Internationalizing your code
- Practicing and exploring
- Summary
- Working with Files, Streams, and Serialization
- Protecting Your Data and Applications
- Working with Databases Using Entity Framework Core
-
Querying and Manipulating Data Using LINQ
- Writing LINQ queries
- Working with sets and bags using LINQ
- Using LINQ with EF Core
- Sweetening LINQ syntax with syntactic sugar
- Using multiple threads with parallel LINQ
- Creating your own LINQ extension methods
- Working with LINQ to XML
- Practicing and exploring
- Summary
- Improving Performance and Scalability Using Multitasking
- Introducing Practical Applications of C# and .NET
- Building Websites Using ASP.NET Core Razor Pages
-
Building Websites Using the Model-View-Controller Pattern
- Setting up an ASP.NET Core MVC website
- Exploring an ASP.NET Core MVC website
-
Customizing an ASP.NET Core MVC website
- Defining a custom style
- Setting up the category images
- Understanding Razor syntax
- Defining a typed view
- Reviewing the customized home page
- Passing parameters using a route value
- Understanding model binders
- Validating the model
- Understanding view helper methods
- Querying a database and using display templates
- Improving scalability using asynchronous tasks
- Using other project templates
- Practicing and exploring
- Summary
-
Building Websites Using a Content Management System
- Understanding the benefits of a CMS
-
Understanding Piranha CMS
- Open source libraries and licensing
- Creating a Piranha CMS website
- Exploring a Piranha CMS website
- Editing site and page content
- Creating a new top-level page
- Creating a new child page
- Reviewing the blog archive
- Commenting on posts and pages
- Exploring authentication and authorization
- Exploring configuration
- Testing the new content
- Understanding routing
- Understanding media
- Understanding the application service
- Understanding content types
- Understanding standard blocks
- Reviewing component types and standard blocks
- Defining components, content types, and templates
- Testing the Northwind CMS website
- Practicing and exploring
- Summary
-
Building and Consuming Web Services
-
Building web services using the ASP.NET Core Web API
- Understanding web service acronyms
- Creating an ASP.NET Core Web API project
- Reviewing the web service's functionality
- Creating a web service for the Northwind database
- Creating data repositories for entities
- Implementing a Web API controller
- Configuring the customers repository and Web API controller
- Specifying problem details
- Controlling XML serialization
- Documenting and testing web services
- Consuming services using HTTP clients
- Implementing advanced features
- Understanding other communication technologies
- Practicing and exploring
- Summary
-
Building web services using the ASP.NET Core Web API
- Building Intelligent Apps Using Machine Learning
- Building Web User Interfaces Using Blazor
-
Building Cross-Platform Mobile Apps
- Understanding XAML
- Understanding Xamarin and Xamarin.Forms
- Building mobile apps using Xamarin.Forms
- Consuming a web service from a mobile app
- Practicing and exploring
- Summary
- Epilogue
- Index
Product information
- Title: C# 9 and .NET 5 – Modern Cross-Platform Development - Fifth Edition
- Author(s):
- Release date: November 2020
- Publisher(s): Packt Publishing
- ISBN: 9781800568105
You might also like
book
C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals - Seventh Edition
Publisher’s Note: Microsoft will stop supporting .NET 7 from May 2024. The newer 8th edition of …
book
C# 10 and .NET 6 – Modern Cross-Platform Development - Sixth Edition
Publisher’s Note: Microsoft will stop supporting .NET 6 from November 2024. The newer 8th edition of …
book
Software Architecture with C# 9 and .NET 5 - Second Edition
Design scalable and high-performance enterprise applications using the latest features of C# 9 and .NET 5 …
book
Software Architecture with C# 10 and .NET 6 - Third Edition
Design scalable and high-performance enterprise applications using the latest features of C# 10 and .NET 6 …