Skip to content
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
jkotas merged 1 commit into
dotnet:masterfrom
justinvp:string_split
Sep 14, 2016
Merged

Update new String.Split methods to use optional params#7175
jkotas merged 1 commit into
dotnet:masterfrom
justinvp:string_split

Conversation

@justinvp
Copy link
Copy Markdown

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) (which binds to Split(string, StringSplitOptions.None)) 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).

https://github.com/dotnet/corefx/issues/1513 (these modifications are api-approved)

cc: @weshaggard, @jkotas, @terrajobst

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)`.
@weshaggard
Copy link
Copy Markdown
Member

LGTM

@jkotas jkotas merged commit 28a41c5 into dotnet:master Sep 14, 2016
@justinvp justinvp deleted the string_split branch September 14, 2016 15:13
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.

4 participants