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

String Join . Add overloads without separator. #28451

Closed
ichensky opened this issue Jan 18, 2019 · 4 comments
Closed

String Join . Add overloads without separator. #28451

ichensky opened this issue Jan 18, 2019 · 4 comments
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Runtime
Milestone

Comments

@ichensky
Copy link
Contributor

Proposal:
Add Join overloads, that it become possible to use this method without separator.

for ex. instead of code

var str = string.Join("",list);

use this:

var str = string.Join(list);
@Tornhoof
Copy link
Contributor

What about string.Concat?

https://docs.microsoft.com/en-us/dotnet/api/system.string.concat?view=netcore-2.2#System_String_Concat__1_System_Collections_Generic_IEnumerable___0__

@ichensky
Copy link
Contributor Author

Yes, it is possible to do this with string.Concat method.
But, Join method can be more flexible/common/intuitive for "joining" strings, if thinking about strings in terms of collections.

Seems, historically method string.Concat was firstly added to .net , because standard c/c++ lang lib has similar method strcat, that concat just 2 strings. Then to the .net were added collections and then was added method for joining strings: string.Join. string.Join can be more common then string.Concat and can covers all functionality of string.Concat.
That's why proposal to add new overloads for string.Join method and mark string.Concat as depreciated.

@Wraith2
Copy link
Contributor

Wraith2 commented Jan 18, 2019

Marking things as deprecated using the Obsolete attribute is considered a breaking change because a lot of people use the treat warnings as errors option and doing so causes obsoletion causes working code to suddenly not in that circumstance.

@joshfree
Copy link
Member

joshfree commented Mar 4, 2019

We wouldn't obsolete Concat because Join is arguably a nicer name 😉

I'm going to close this api-suggestion given the discussion wrapped up in January. Feel free to reactivate with more details. Thank you

@joshfree joshfree closed this as completed Mar 4, 2019
@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 3.0 milestone Feb 1, 2020
@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Runtime
Projects
None yet
Development

No branches or pull requests

5 participants