Book Image

C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals - Eighth Edition

By : Mark J. Price
4.6 (14)
Book Image

C# 12 and .NET 8 – Modern Cross-Platform Development Fundamentals - Eighth Edition

4.6 (14)
By: Mark J. Price

Overview of this book

This latest edition of the bestselling Packt series will give you a solid foundation to start building projects using modern C# and .NET with confidence. You'll learn about object-oriented programming; writing, testing, and debugging functions; and implementing interfaces. You'll take on .NET APIs for managing and querying data, working with the fi lesystem, and serialization. As you progress, you'll explore examples of cross-platform projects you can build and deploy, such as websites and services using ASP.NET Core. This latest edition integrates .NET 8 enhancements into its examples: type aliasing and primary constructors for concise and expressive code. You'll handle errors robustly through the new built-in guard clauses and explore a simplified implementation of caching in ASP.NET Core 8. If that's not enough, you'll also see how native ahead-of-time (AOT) compiler publish lets web services reduce memory use and run faster. You'll work with the seamless new HTTP editor in Visual Studio 2022 to enhance the testing and debugging process. You'll even get introduced to Blazor Full Stack with its new unified hosting model for unparalleled web development flexibility.
Table of Contents (18 chapters)

Reviewing the Blazor Web App project template

Before .NET 8, there were separate project templates for the different hosting models, for example, Blazor Server App, Blazor WebAssembly App, and Blazor WebAssembly App Empty. Introduced with .NET 8 is a unified project template named Blazor Web App and a client-only project template renamed Blazor WebAssembly Standalone App. Consider all the others legacy and avoid them unless you must use older .NET SDKs.

Creating a Blazor Web App project

Let’s look at the default template for a Blazor Web App project. Mostly, you will see that it is the same as an ASP.NET Core Empty template, with a few key additions:

  1. Use your preferred code editor to open the PracticalApps solution and then add a new project, as defined in the following list:
    • Project template: Blazor Web App / blazor --interactivity None
    • Solution file and folder: PracticalApps
    • Project file and folder: Northwind.Blazor
    • ...