Skip to content

Update readability#52115

Open
ivanPeshterskii wants to merge 2 commits intodotnet:mainfrom
ivanPeshterskii:update-readability
Open

Update readability#52115
ivanPeshterskii wants to merge 2 commits intodotnet:mainfrom
ivanPeshterskii:update-readability

Conversation

@ivanPeshterskii
Copy link

Summary

This PR refactors the console sample to improve readability and maintainability.
The functionality of the sample remains unchanged.

Changes

  • Replaced do...while(true) with while(true) for clearer control flow
  • Extracted magic numbers into named constants
  • Simplified Console.WriteLine formatting
  • Introduced intermediate variables to improve readability
  • Updated Console.ReadKey() to Console.ReadKey(true) to prevent echoing the pressed key in the console

Reason for change

The original version of the sample used inline formatting and magic numbers, which made the code slightly harder to read and maintain.
These changes make the example easier to understand, especially for developers who are learning console input and basic string processing.

Impact

  • No functional changes
  • No breaking changes
  • Improves clarity and maintainability of the sample

Testing

The sample was compiled and executed to confirm that the behavior remains the same.

@ivanPeshterskii ivanPeshterskii requested review from a team, adegeo and meaghanlewis as code owners March 8, 2026 22:27
@dotnetrepoman dotnetrepoman bot added this to the March 2026 milestone Mar 8, 2026
@dotnet-policy-service dotnet-policy-service bot added dotnet-fundamentals/svc dotnet-docker/subsvc community-contribution Indicates PR is created by someone from the .NET community. labels Mar 8, 2026
@gewarren gewarren requested a review from BillWagner March 11, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-docker/subsvc dotnet-fundamentals/svc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant