Skip to content
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

Use StringBuilder.Append(Char) instead of coverting char to string #32758

Merged
merged 1 commit into from
Feb 25, 2020

Conversation

alaatm
Copy link
Contributor

@alaatm alaatm commented Feb 24, 2020

No description provided.

@EgorBo
Copy link
Member

EgorBo commented Feb 24, 2020

it'd be nice to for static analyzer to find patterns like stringBuilder.Append(charVar.ToString()) and suggest to use the char overload instead

@stephentoub
Copy link
Member

t'd be nice to for static analyzer to find patterns like stringBuilder.Append(charVar.ToString()) and suggest to use the char overload instead

Yup, and not just for char, but in general Append(primitive.ToString()) should just be Append(primitive). It's already on the list at #30740 😄 If you have other ideas, please do comment on that issue to suggest them.
cc: @terrajobst

@stephentoub stephentoub merged commit bddb0d4 into dotnet:master Feb 25, 2020
@alaatm alaatm deleted the appendchar branch February 25, 2020 18:13
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants