-
Notifications
You must be signed in to change notification settings - Fork 369
Open
Description
Page 235:
the line "int result = x.Name.Length.CompareTo(y.Name.Length) results in the errors "'Name may be null here. Dereference of a possibly null reference".
To fix it, you must test to make sure that Name is not null first:
if((x is not null) && (y is not null))
{
if(x.Name is null) return 1;
if(y.Name is null) return -1;
int result = x.Name.Length.CompareTo(y.Name.Length);
}
Obviously, the errors disappear if you modify the file according to the "errata" for null values for page 235, but, as printed, the text does not work.
A possible VS Code version issue? Using VS Code version 1.69.1
Metadata
Metadata
Assignees
Labels
No labels