Skip to content

How to Convert Int to String in C#: .NET 10, BenchmarkDotNet, culture tests - #2325

Merged
vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/65890-csharp-convert-int-to-string
Oct 27, 2026
Merged

vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/65890-csharp-convert-int-to-string

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Moves strings-csharp/ConvertInt2String to net10.0 with MSTest 4.5.1, replaces the hand-rolled Stopwatch benchmark (its ConvertToString case called ToString) with a BenchmarkDotNet class that measures all eight conversions for 3 and 1,234,567 with allocations and takes command-line arguments through BenchmarkSwitcher, adds the four culture lines the article prints to Program.cs, and adds two tests showing that sv-SE formats a negative int with the Unicode minus sign while the invariant culture uses the hyphen.

…tests

Retarget both projects to net10.0, update MSTest to 4.5.1 and the test SDK and coverlet to current releases, replace the Stopwatch benchmark (whose ConvertToString case measured ToString) with a BenchmarkDotNet class run through BenchmarkSwitcher, and add two tests for the negative sign under sv-SE and the invariant culture.
@vladimir-pecanac-main
vladimir-pecanac-main merged commit d2c6d0b into CodeMazeBlog:main Oct 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant