Chapter 2, StringSample
Chapter 3, Math Sample
Parameterless struct constructor
See chapter 3, StructsSample
New LINQ methods - see LINQ
See chapter 8.
New PriorityQueue
class with .NET 6 - see Collections
Instead of using the Marshal
class to allocate native memory, the NativeMemory
class can be used. See the SpanSample in Chapter 13, "Managed and Unmanaged Memory"
Instead of using Marshal.GetLastWin32Error, Marshal.GetLastPInvokeError can be used. See the PInvokeSampleLib in Chapter 13, "Managed and Unmanaged Memory"
.NET 6 adds an API for writeable JSON DOM. See the Files and Streams
See chapter 18, Files and Streams for more information on JSON.
ASP.NET Core 6 adds the WebApplicationBuilder
and WebApplication classes which abstracts the
Hostclass. The code in the repo has been updated to use the
WebApplicationand
WebApplicationBuilder` classes.
See chapter 19, "Networking" for more information on network programming.
Sample code: X509CertificateSample
With .NET 6, the Key
property of the PublicKey
property is deprecated. The sample code is changed to use the GetRSAPublicKey
method instead - using the RSA
class and accessing its members.
See chapter 20, Security for more information on security.
New feature with EF Core 6:
Temporal Tables
EF Core 6 has better support for non nullable reference types. This allows getting rid of some uses of the null forgiving operator, for example with MenusContext.
Breaking changes with EF Core 6 which requires a change with owned entities (see the Relationships sample). One change is that owned entities can't be nullable if they contain another owned entity and are not mapped to a different table. Another change is with seeding. With the Relationships sample, the Bank and Menus context use data seeding to fill initial data. With the Books context, instead of data seeding, entities are now normally added to the database which removes the requirement using anonymous types with n-to-n relations and owned entities.
See chapter 21, EF Core for more information on EF Core.
With Windows App SDK 1.0, the namespace for MRT Core changed. See Access app resources with MRT Core and chapter 22, Localization, sample WinUILocalization.
See chapter 23, Tests, sample ASPNETCoreSample
The Web application project needs to give access for the unit testing project (ASPNETCoreSample.csproj):
<ItemGroup>
<InternalsVisibleTo Include="ASPNETCoreSample.IntegrationTest"/>
</ItemGroup>
See how the `WebApplicationFactory` is now used to access the `Program` class from the ASP.NET Core project in the test project *ASPNETCoreSample.IntegrationTest*
## ASP.NET Core
See the chapters 24, **ASP.NET Core"", 25 **Services**, 26 **Razor Pages and MVC**, and 27, **Blazor** for changes replacing the `Startup` class with top-level statements and the new `WebApplicationBuilder` class.