dotnet-api-docs
dotnet-api-docs copied to clipboard
Comparer<T> code snippet issues
https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.comparer-1?view=net-8.0#examples
In the examples code snippet, the comment above the declaration of LengthFirst talks about an explicit interface implementation, but I don't see this anywhere in the snippet.
The snippet has some other issues too, including:
- Local variables named in pascal case (
Boxes,LengthFirst,BoxAandBoxB) - Ancient string formatting (should be using string interpolation instead)
- Unused variables (
defComp,bc) - Weird variable names (why
bxinstead ofbox, whydefCompinstead ofdefaultComparer, what isbc?) - The
Comparemethods could use some variables for clarity and code quality - Use collection expression for creating the list
Tagging subscribers to this area: @dotnet/area-system-collections