This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Update new String.Split methods to use optional params#7175
Merged
Conversation
The new `Split(string)` overload broke source compat with uses of `Split(null)`, which is documented to split based on white space, because it makes the call ambiguous between `Split(char[])` and `Split(string)`. To maintain source compatibilty, `Split(string)` has been removed, leaving just the overloads with `StringSplitOptions` parameters, which are now optional. Making `StringSplitOptions` optional allows calls to `Split(string)` while maintaining source compat with calls to `Split(null)` which still binds to `Split(char[])` in C#, VB, and F#. The new `Split(char)` overloads get the same changes for consistency with `Split(string)`.
Member
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The new
Split(string)overload broke source compat with uses ofSplit(null), which is documented to split based on white space, because it makes the call ambiguous betweenSplit(char[])andSplit(string).To maintain source compatibilty,
Split(string)has been removed, leaving just the overloads withStringSplitOptionsparameters, which are now optional. MakingStringSplitOptionsoptional allows calls toSplit(string)(which binds toSplit(string, StringSplitOptions.None)) while maintaining source compat with calls toSplit(null)which still binds toSplit(char[])in C#, VB, and F#.The new
Split(char)overloads get the same changes for consistency withSplit(string).https://github.com/dotnet/corefx/issues/1513 (these modifications are api-approved)
cc: @weshaggard, @jkotas, @terrajobst