Code review E: examples polish#141
Merged
Merged
Conversation
…review group E)
Both example Programs had 8 near-duplicate Console.WriteLine lines
each (one per test value, twice — IsBetween then IsInRange). Collapsed
to a 4-element int[] + two foreach loops. The example reads as a
single pattern, not eight near-duplicates.
Also:
- DotNet462: uses '+' string concat. .NET Framework 4.6.2 supports
C# 6 string interpolation; switched to interpolated strings with
format alignment ({value,2}) to make the column line up without
the manual ' ' vs ' ' padding the old code used.
- DotNet8: dropped the stray blank line after the opening brace,
switched 'Console.WriteLine("\n")' (which prints two newlines)
to 'Console.WriteLine()' for one separator line, and used a
collection expression '[1, 2, 9, 10]' since the example targets
net8.0.
Both example projects still build clean in Release.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR polishes the example console apps by reducing duplicated output code and standardizing the formatting of the example output, without changing the library itself.
Changes:
- Refactors repeated
Console.WriteLineblocks into a sharedint[]+ twoforeachloops per example. - Standardizes value column padding using format alignment instead of manual spacing.
- Cleans up newline usage (e.g., replacing
"\n"+WriteLinewithWriteLine()).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| examples/Wolfgang.Extensions.IComparable.DotNet8.Example1/Program.cs | Deduplicates output and normalizes formatting/newlines for the .NET 8 example. |
| examples/Wolfgang.Extensions.IComparable.DotNet462.Example1/Program.cs | Deduplicates output and normalizes formatting (including interpolation/alignment) for the .NET Framework 4.6.2 example. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Collapses 8 near-duplicate WriteLine blocks per example file to a 4-element
int[]+ twoforeachloops. Also fixes inconsistent column padding (manual spaces → format alignment), switches the net462 example from+string concat to interpolation (C# 6, supported on net462 since 2015), and cleans up a stray blank line + double-newline in the net8 example.Pure example polish — no library changes. Both example projects build clean in Release.
Stacked on vNext (PR #129).