Skip to content

Latest commit

 

History

History
108 lines (69 loc) · 3.19 KB

File metadata and controls

108 lines (69 loc) · 3.19 KB

Book Updates and Issues

See .NET 6 Updates for changes with .NET 6

Chapter 4, Object-Oriented Programming in C#

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:

Chapter 7, Delegates, Lambdas and Events

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!

Chapter 11, Tasks and Asynchronous Programming

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();

Chapter 12, Reflection, Metadata, and Source Generators

Page 312 (below the title The WhatsNewAttributes Library) has this text:

The source code is contained in the file WhatsNewAttributes.cs in 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.cs in the WhatsNewAttributes project of the ReflectionSamples solution in the example code for this chapter.

Thanks to @ShervanN for reporting this issue!

Chapter 15, Dependency Injection and Configuration

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!

Chapter 20, Security

Page 560, the command

az app list --display-name ProCSharpIdentityApp --query [].appId

should be:

az ad app list --display-name ProCSharpIdentityApp --query [].appId

Chapter 27, Blazor

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.