See .NET 6 Updates for changes with .NET 6
Page 98, Rectangle.Clone method - the Heightshould be assigned to Height:
public override Rectangle Clone()
{
//...
r.Size.Height = Size.Height;
return r;
}Page 101, at the end of the page, the Heightshould be assigned to Height:
public override Rectangle Clone()
{
//...
r.Size.Height = Size.Height;
return r;
}Thanks to @lriy816 for reporting this issue by creating these pull requests:
Page 190, the event name should be NewCarCreated instead of NewCarInfo:
public event EventHandler<CarInfoEventArgs>? NewCarCreated;See source code - CarDealer.cs
Thanks to @DanielNikoofar for reporting this issue!
Page 296 shows this source code:
private readonly static Dictionary<string, string> names = new Dictionary<string, string>();With C# 9 and target-typed new expressions, the code can be written as shown:
private readonly static Dictionary<string, string> names = new();Page 312 (below the title The WhatsNewAttributes Library) has this text:
The source code is contained in the file
WhatsNewAttributes.csin the WhatsNewAttributes project of the WhatsNewAttributes solution in the example code for this chapter.
It's the ReflectionSamples solution. This is the correct text:
The source code is contained in the file
WhatsNewAttributes.csin the WhatsNewAttributes project of the ReflectionSamples solution in the example code for this chapter.
Thanks to @ShervanN for reporting this issue!
Page 394, the code snippet in the book misses a variable name. The variable services should be added:
static ServiceProvider GetServiceProvider()
{
ServiceCollection services = new(); // Here the variable name is missing in the book
services.AddSingleton<IGreetingService, GreetingService>();
services.AddTransient<HomeController>();
return services.BuildServiceProvider();
}Thanks to @ShervanN for reporting this issue!
Page 560, the command
az app list --display-name ProCSharpIdentityApp --query [].appId
should be:
az ad app list --display-name ProCSharpIdentityApp --query [].appId
Page 792, the command
dotnet new blazorwasm --hosted -o BlazorComponentsSample
should be
dotnet new blazorwasm -o BlazorComponentsSample
More information: this project is created without a hosting application. Blazor.Wasm with a hosting application is created in the previous code sample.