Skip to content

Conversation

@xtqqczze
Copy link
Contributor

PR Summary

Autofix RCS1198: Avoid unnecessary boxing of value type

If the compiler added ToString at compile time, we wouldn't need this, see dotnet/roslyn#44168

PR Context

https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1198.md

PR Checklist

@iSazonov
Copy link
Collaborator

@xtqqczze I don't see a value from this change. Extra boxing is critical on hot paths but I don't see such code in the PR. I suggest to close the PR.

@xtqqczze
Copy link
Contributor Author

@iSazonov More importantly the Roslyn compiler doesn't box on string concatenation: dotnet/roslyn#35006

@xtqqczze xtqqczze closed this Aug 14, 2020
@xtqqczze
Copy link
Contributor Author

xtqqczze commented Aug 14, 2020

@iSazonov More importantly the Roslyn compiler doesn't box on string concatenation: dotnet/roslyn#35006

Apparently this is only for +operator and not string.Concat though:

https://sharplab.io/#v2:EYLgtghgzgLgpgJwDQxASwDYB8ACAmARgFgAoHAZgAJ9KBhSgb1MpcoAcE0A3CeaggGzUALJQCCAChwEADAG0AupQgIA5lACUzVkxKt9/GZSiUAvMrVQAdABk4AO1UwAFpQDUlAEQAPTwG5tFgBfQPZOHj5pIRxRACEpWUULdS09HVD9aSMTcyyrWgB7ewBjXgkVdVsHJ2ckL18NALTg0iCgA===

C#/VB/F# compiler playground.

@xtqqczze xtqqczze deleted the RCS1198 branch August 14, 2020 13:01
@xtqqczze
Copy link
Contributor Author

Issue opened: dotnet/roslynator#708

@xtqqczze xtqqczze restored the RCS1198 branch August 20, 2020 12:24
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.

4 participants