Skip to content

Use Convert.ToHexStringLower() in C# #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

xakep139
Copy link
Contributor

@xakep139 xakep139 commented Jan 22, 2025

There's a bunch of custom-made ToHexString() methods with the same implementation. As per Performance Improvements in .NET 9, it's better to use built-in and optimized Convert.ToHexStringLower() method.
That way, it will both (a) reduce code duplication and (b) slightly improve performance.

@xakep139
Copy link
Contributor Author

@hanabi1224
Copy link
Owner

Thanks, LGTM.

@xakep139
Copy link
Contributor Author

Thanks, LGTM.

Done, please review

@xakep139 xakep139 marked this pull request as ready for review January 22, 2025 14:34
@xakep139
Copy link
Contributor Author

So, the build error is:
image

Since Mono's implementation of System.Convert class doesn't have an implementation of the ToHexString() and ToHexStringLower() methods (see the code), I'm gonna close this PR.

@hanabi1224 FYI, as more and more new .NET APIs won't work with Mono compiler.

@xakep139 xakep139 closed this Jul 12, 2025
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.

2 participants