Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals
  • Toc
  • feedback
C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals

C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals

By : Mark J. Price
4.4 (5)
close
C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals

C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals

4.4 (5)
By: Mark J. Price

Overview of this book

This Packt bestseller continues to be the definitive guide to modern cross-platform development. The 9th edition of C# 13 and .NET 9 – Modern Cross-Platform Development Fundamentals has been updated to cover the latest features and improvements in .NET 9 and C# 13. You'll start by mastering object-oriented programming, learning how to write, test, and debug functions, and implementing interfaces. You'll then dive into .NET APIs for data management, filesystem operations, and serialization. This latest edition integrates .NET 9 enhancements into its examples: faster exceptions and new LINQ methods. New ASP.NET Core 9 features include optimized static assets, built-in OpenAPI document generation, and the HybridCache. Practical examples, such as building websites and services with ASP.NET Core, have been refreshed to utilize the latest .NET 9 features. The book also introduces Blazor, with its new unified hosting model for unparalleled code reusability. With these updates, you'll learn how to build robust applications and services efficiently and effectively. By the end of this book, you'll have the knowledge and confidence to create professional and high-performance web applications using the latest technologies in C# 13 and .NET 9.
Table of Contents (18 chapters)
close
17
Index

Making good use of the GitHub repository for this book

Git is a commonly used source code management system. GitHub is a company, website, and desktop application that makes it easier to manage Git. Microsoft purchased GitHub in 2018, so it will continue to get closer integration with Microsoft tools.

I created a GitHub repository for this book, and I use it for the following:

  • To store the solution code for the book that can be maintained after the print publication date.
  • To provide extra materials that extend the book, like errata fixes, small improvements, lists of useful links, and optional sections about topics that cannot fit in the printed book.
  • To provide a place for readers to get in touch with me if they have issues with the book.

Good Practice: I strongly recommend that you all review the errata, improvements, post-publication changes, and common errors pages before attempting any coding task in this book. You can find them at the following link: https://github.com/markjprice/cs13net9/blob/main/docs/errata/README.md.

Understanding the solution code on GitHub

The solution code in the GitHub repository for this book includes folders for each chapter that can be opened with any of the following code editors:

  • Visual Studio or Rider: Open the .sln solution file.
  • VS Code: Open the folder that contains the solution file.

Chapters 1 to 11 each have their own solution file named ChapterXX.sln, where XX is the chapter number 01 to 11. Chapters 12 to 15 share a single solution file named ModernWeb.sln.

The .sln solution file format is a Microsoft proprietary file format that is verbose, hard to read, and uses Globally Unique Identifiers (GUIDs) to reference projects and other components of a solution. A new format based on XML, designed to be simpler and easier to read, is coming soon and will use the .slnx file extension. You can learn more about this at the following link: https://github.com/dotnet/sdk/issues/40913.

All the code solutions can be found at the following link:

https://github.com/markjprice/cs13net9/tree/main/code

Good Practice: If you need to, return to this chapter to remind yourself how to create and manage multiple projects in the code editor of your choice. The GitHub repository has step-by-step instructions for three code editors (Visual Studio, VS Code, and Rider), along with additional screenshots: https://github.com/markjprice/cs13net9/tree/main/docs/code-editors/.

Raising issues with the book

If you get stuck following any of the instructions in this book, or if you spot a mistake in the text or the code in the solutions, please raise an issue in the GitHub repository:

  1. Use your favorite browser to navigate to the following link: https://github.com/markjprice/cs13net9/issues.
  2. Click New Issue.
  3. Enter as much detail as possible that will help me to diagnose the issue. For example:
    • The specific section title, page number, and step number.
    • As much of your code and configuration that you feel is relevant and necessary.
    • A description of the expected behavior and the behavior experienced.
    • Screenshots (you can drag and drop image files into the Issue box).

The following is less relevant but might be useful:

  • Your code editor, for example, Visual Studio, VS Code, Rider, or something else, including the version number.
  • Your operating system, for example, Windows 11 64-bit or macOS Ventura version 13.5.2
  • Your hardware, for example, Intel, Apple Silicon, or ARM CPU

I cannot always respond immediately to issues. But I want all my readers to find success with my book, so if I can help you (and others) without too much trouble, then I will gladly do so.

Giving me feedback

If you’d like to give me more general feedback about the book, then either email me at [email protected] or ask me a question on Discord in the book channel. You can provide the feedback anonymously, or if you would like a response from me, then you can supply an email address. I will only use this email address to answer your feedback.

Please join me and your fellow readers on Discord using this invite: https://packt.link/csharp13dotnet9.

I love to hear from my readers about what they like about my book, as well as suggestions for improvements and how they are working with C# and .NET, so don’t be shy. Please get in touch!

Thank you in advance for your thoughtful and constructive feedback.

Avoiding common mistakes

After working through the step-by-step tasks in this book, readers often then strike out on their own and attempt to write similar code, but sometimes, they hit problems and either raise an issue in the GitHub repository or post a question to the Discord channel for the book.

From these, I have noted some common mistakes, so I maintain a page in the repository to highlight and explain these potential traps and how to fix them:

https://github.com/markjprice/cs13net9/blob/main/docs/errata/common-mistakes.md

Downloading solution code from the GitHub repository

If you just want to download all the solution files without using Git, click the green <> Code button and then select Download ZIP, as shown in Figure 1.10:

Figure 1.10: Downloading the repository as a ZIP file

Good Practice: It is best to clone or download the code solutions to a short folder path, like C:\cs13net9\ or C:\book\, to avoid build-generated files that exceed the maximum path length. You should also avoid special characters like #. For example, do not use a folder name like C:\C# projects\. That folder name might work for a simple console app project, but once you start adding features that automatically generate code, you are likely to have strange issues. Keep your folder names short and simple.

Using Git with VS Code and the command prompt

VS Code has integrations with Git, but it will use your operating system’s Git installation, so you must install Git 2 or later first before you get these features.

You can install Git from the following link: https://git-scm.com/download.

If you like to use a GUI, you can download GitHub Desktop from the following link: https://desktop.github.com.

Cloning the book solution code repository

Let’s clone the book solution code repository. In the steps that follow, you will use the VS Code terminal, but you can enter the commands at any command prompt or terminal window:

  1. Create a folder named Repos-vscode in your user or Documents folder, or wherever you want to store your Git repositories.
  2. Open the Repos-vscode folder at the command prompt or terminal, and then enter the following command:
    git clone https://github.com/markjprice/cs13net9.git
    

Note that cloning all the solutions for all the chapters will take a minute or so, so please be patient.

bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete