
C# 14 and .NET 10 - Modern Cross-Platform Development Fundamentals
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
- Build professional modern websites and services with ASP.NET Core, Blazor, and Minimal API services
- Enhance your skills with step-by-step code examples and good practice tips
Book DescriptionC# and.NET continue to power modern cross-platform and enterprise development. With the release of C# 14 and.NET 10, developers gain access to a more capable, efficient, and future-ready platform for building websites, services, and applications across Windows, Linux, and macOS. This fully updated tenth edition takes a practical, hands-on approach. You'll start with core C# and object-oriented programming concepts, then progress through building, testing, and debugging applications while working with.NET libraries, filesystems, serialization, and LINQ. The book covers key C# 14 enhancements-such as field modifiers, partial events, and instance constructors, explained through real-world examples. You'll also build modern web solutions using ASP.NET Core 10, Blazor, and Minimal APIs, including support for native AOT compilation, making this book well suited for cloud-native, microservice, and container-based development. By the end of the book, you'll be confident in building maintainable, high-performance websites and services aligned with modern.NET development practices.What you will learn - Discover the new features in.NET 10, including the NumericOrdering option and OrderedDictionary enhancements
- Leverage the latest ASP.NET Core 10 features, such as OpenAPI 3.1 document generation, YAML format support, and populating XML doc comments
- Use native AOT publishing for faster startup and reduced memory footprint
- Build rich web user interface experiences with Blazor
- Integrate databases into your applications using EF Core 10 entity models
- Query and manipulate data using LINQ
- Develop powerful web services with Minimal APIs
Who this book is forThis book is for beginner-to-intermediate C# and.NET developers who want to build modern, cross-platform websites and services. Prior experience with C# or.NET is helpful but not required; a basic understanding of programming concepts is sufficient.
All prices
More details
Content
- Cover
- Title Page
- Copyright Page
- Contributors
- Table of Contents
- Preface
- Free Benefits with Your Book
- Chapter 1: Hello, C#! Welcome, .NET!
- Introducing this book and its contents
- Setting up your development environment
- Understanding .NET
- Building console apps and managing multiple projects in a solution
- Making good use of the GitHub repository for this book
- Running a C# code file without a project file
- Looking for help
- Practicing and exploring
- Summary
- Chapter 2: Speaking C#
- Introducing the C# language
- Discovering your C# compiler version
- Understanding C# grammar and vocabulary
- Working with variables
- Exploring more about console apps
- Practicing and exploring
- Summary
- Chapter 3: Controlling Flow, Converting Types, and Handling Exceptions
- Operating on variables
- Understanding selection statements
- Understanding iteration statements
- Storing multiple values in an array
- Casting and converting between types
- Handling exceptions
- Checking for overflow
- Practicing and exploring
- Summary
- Chapter 4: Writing, Debugging, and Testing Functions
- Writing functions
- Debugging during development
- Hot reloading during development
- Unit testing
- Throwing and catching exceptions in functions
- Practicing and exploring
- Summary
- Chapter 5: Building Your Own Types with Object-Oriented Programming
- Talking about OOP
- Building class libraries
- Storing data in fields
- Working with methods and tuples
- Controlling access with properties and indexers
- Pattern matching with objects
- Working with record types
- Practicing and exploring
- Summary
- Chapter 6: Implementing Interfaces and Inheriting Classes
- Setting up a class library and console app
- Static methods and overloading operators
- Making types safely reusable with generics
- Raising and handling events
- Implementing interfaces
- Working with null values
- Inheriting from classes
- Casting within inheritance hierarchies
- Inheriting and extending .NET types
- Practicing and exploring
- Summary
- Chapter 7: Packaging and Distributing .NET Types
- The road to .NET 10
- Understanding .NET components
- Publishing your code for deployment
- Native ahead-of-time compilation
- Packaging your libraries for NuGet distribution
- Practicing and exploring
- Summary
- Chapter 8: Working with Common .NET Types
- Working with numbers
- Working with text
- Pattern matching with regular expressions
- Storing multiple objects in collections
- Practicing and exploring
- Summary
- Chapter 9: Working with Files, Streams, and Serialization
- Managing a filesystem
- Reading and writing with streams
- Encoding and decoding text
- Serializing object graphs
- Practicing and exploring
- Summary
- Chapter 10: Working with Data Using Entity Framework Core
- Understanding modern databases
- Setting up EF Core in a .NET project
- Defining EF Core models
- Querying EF Core models
- Practicing and exploring
- Summary
- Chapter 11: Querying and Manipulating Data Using LINQ
- Writing LINQ expressions
- LINQ in practice
- Sorting and more
- Using LINQ with EF Core
- Joining, grouping, and lookups
- Practicing and exploring
- Summary
- Chapter 12: Introducing Modern Web Development Using .NET
- Understanding ASP.NET Core
- Structuring projects
- Building an entity model for use in the rest of the book
- Practicing and exploring
- Summary
- Chapter 13: Building Websites Using ASP.NET Core
- Exploring ASP.NET Core
- History of Blazor
- Exploring Blazor static SSR
- Using EF Core with ASP.NET Core
- Practicing and exploring
- Summary
- Chapter 14: Building Interactive Web Components Using Blazor
- Reviewing the Blazor Web App project template
- Building components using Blazor
- Defining forms using the EditForm component
- Practicing and exploring
- Summary
- Chapter 15: Building and Consuming Web Services
- Building web services using ASP.NET Core
- Creating a web service for the Northwind database
- Documenting and trying out web services
- Consuming web services using HTTP clients
- Practicing and exploring
- Summary
- Unlock Your Exclusive Benefits
- Epilogue
- Next steps on your C# and .NET learning journey
- Using this book with future versions of .NET
- Good luck!
- Packt Page
- Index
1
Hello, C#! Welcome, .NET!
In this first chapter, the main goal is to set up your development environment to use Visual Studio 2026, Visual Studio Code, or JetBrains Rider.
Throughout this book, I will use the names Visual Studio, VS Code, and Rider to refer to these three code editors, respectively.
The other goals are understanding the similarities and differences between modern .NET, .NET Core, .NET Framework, Mono, Xamarin, and .NET Standard; creating the simplest application possible with C# 14 and .NET 10, using various code editors; discovering good places to look for help; and learning how to make the most of modern AI workflows.
My style of writing ensures that you can get started from my book and then switch to online documentation and other online resources, like videos, blogs, and forums, which are the main ways that developers like to learn, as shown at the following link: https://survey.stackoverflow.co/2025/developers#2-how-did-you-learn-to-code.
This chapter covers the following topics:
- Introducing this book and its contents
- Setting up your development environment
- Understanding .NET
- Building console apps and managing multiple projects in a solution
- Making good use of the GitHub repository for this book
- Running a C# code file without a project file
- Looking for help
Free Benefits with Your Book
Your purchase includes a free PDF copy of this book along with other exclusive benefits. Check the Free Benefits with Your Book section in the Preface to unlock them instantly and maximize your learning experience.
Introducing this book and its contents
Let's get started by introducing you to the code solutions, structure, and content of this book.
Getting code solutions for this book
You can complete all the coding tasks just from reading this book because all the code statements that you need to enter are shown in the pages. You do not need to download or clone the solution code to complete this book. The solution code is provided in the GitHub repository only so that you can view it if you get stuck working from the book, and to save you time from entering long files yourself. It is also more reliable to copy from an actual code file than from a PDF or other e-book format.
The GitHub repository for this book has solutions that use full application projects for all code tasks and exercises, found at the following link:
https://github.com/markjprice/cs14net10.
After navigating to the GitHub repository in your web browser, you can press the . (dot) key on your keyboard, or manually change .com to .dev in the link to convert the repository into a live code editor based on VS Code, called GitHub Codespaces, as shown in Figure 1.1:
Figure 1.1: GitHub Codespaces viewing the book's GitHub repository
Warning! When you access a repository using GitHub Codespaces, its GitHub Repositories extension will attempt to download the repository's index. By default, the maximum size can be up to 50 MB, but the repository exceeds this limit, so you will see the following warning message: Repository exceeds download size limit! Continuing with partial text services. You can ignore this message because you are not using the full features.
VS Code in a web browser is great to run alongside your chosen local code editor as you work through the book's coding tasks. You can compare your code to the solution code and easily copy and paste parts if needed.
You do not need to use or know anything about Git to get the solution code of this book. You can download a ZIP file containing all the code solutions by using the following direct link and then extracting the ZIP file into your local filesystem: https://github.com/markjprice/cs14net10/archive/refs/heads/main.zip.
.NET terms used in this book
Throughout this book, I use the term modern .NET to refer to .NET 10 and its predecessors, like .NET 6, that derive from .NET Core. I use the term legacy .NET to refer to .NET Framework, Mono, Xamarin, and .NET Standard. Modern .NET is a unification of those legacy platforms and standards.
The style of this book
Most people learn complex topics best by imitation and repetition, rather than reading a detailed explanation of the theory; therefore, I will not overload you with detailed explanations of every step throughout this book. The idea is to get you to write some code and see it run.
You don't need to know all the nitty-gritty details immediately. That will be something that comes with time as you build your own apps and go beyond what any book can teach you.
In the words of Samuel Johnson, author of the English dictionary in 1755, I have committed "a few wild blunders, and risible absurdities, from which no work of such multiplicity is free." I take sole responsibility for these and hope you appreciate the challenge of my attempt to lash the wind by writing this book about rapidly evolving technologies, like C# and .NET, and the apps that you can build with them.
If you have a complaint about this book, then please contact me before writing a negative review on Amazon. Authors cannot respond to Amazon reviews, so I cannot contact you to resolve the problem and help you, or listen to your feedback and try to do better in the next edition. Please ask a question on the Discord channel for this book at https://packt.link/cs14net10, email me at markjprice@gmail.com, or raise an issue in the GitHub repository for the book at the following link: https://github.com/markjprice/cs14net10/issues.
Topics covered by this book
The following topics are covered in this book:
- Language fundamentals: Fundamental features of the C# language, from declaring variables to writing functions and object-oriented programming.
- Library fundamentals: Fundamental features of the .NET base class library, as well as some important optional packages for common tasks like database access.
- Modern web development fundamentals: Modern features of the ASP.NET Core framework for server-side and client-side website and web service development. This includes Blazor and Minimal API web services and excludes controller-based features like MVC and Web API, or legacy features like Razor Pages.
This book, C# 14 and .NET 10 - Modern Cross-Platform Development Fundamentals, is best read linearly, chapter by chapter, because it builds up fundamental skills and knowledge.
Now that you know what this book covers, let's review what the other three books in the quartet cover.
Topics covered by Real-World Web Development with .NET 10
The following topics are available in a companion book, Real-World Web Development with .NET 10:
- ASP.NET Core MVC: Build websites using a mature and proven Model-View-Controller architecture pattern
- ASP.NET Core Web API: Build web services using controllers
- OData and FastEndpoints: Build web services using specialized libraries
- Testing and Containerization: Test web user interfaces and containerize your web projects ready for deployment
- Umbraco CMS: Build websites with content managed by end users
The first half of this book should be read linearly, and the second half can be read more like a cookbook, so if you are especially interested in building web services using FastEndpoints, then you can read that chapter without the preceding chapters about ASP.NET Core OData web services.
Topics covered by Apps and Services with .NET 10
The following topics are available in a companion book, Apps and Services with .NET 10:
- User interfaces: Avalonia for desktop apps, Blazor for web apps, and .NET MAUI for mobile apps
- Specialized libraries: Dates, times, time zones, and internationalization; common third-party libraries for image handling, logging, mapping, and generating PDFs; and many more
- Data: SQL Server, ADO.NET, Dapper, and EF Core
- Services: Caching, queuing, background services, gRPC, GraphQL, SignalR, and Minimal API web services
This book can be read like a cookbook, so if you are especially interested in building gRPC services, then you can read that chapter without the preceding chapters about ASP.NET Core Minimal API web services.
Topics covered by Tools and Skills for .NET 10
The following topics are available in a companion book, Tools and Skills for .NET 10:
- Mastering the features of your code editor, Visual Studio or VS...
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.
File format: ePUB
Copy protection: without DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use a reader that can handle the file format ePUB, such as Adobe Digital Editions or FBReader – both free (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePUB works well for novels and non-fiction books – i.e., 'flowing' text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook does not use copy protection or Digital Rights Management
For more information, see our eBook Help page.