Skip to content

Clean up our newline-fixing extension methods#83043

Open
jasonmalinowski wants to merge 1 commit intodotnet:mainfrom
jasonmalinowski:simplify-string-test-helpers
Open

Clean up our newline-fixing extension methods#83043
jasonmalinowski wants to merge 1 commit intodotnet:mainfrom
jasonmalinowski:simplify-string-test-helpers

Conversation

@jasonmalinowski
Copy link
Copy Markdown
Member

@jasonmalinowski jasonmalinowski commented Apr 2, 2026

No reason to define extension methods when they'll lose to the framework provided ones.

Microsoft Reviewers: Open in CodeFlow

No reason to define extension methods when they'll lose to the
framework provided ones.
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner April 2, 2026 21:46
@jasonmalinowski jasonmalinowski requested a review from jaredpar April 2, 2026 21:47
Copy link
Copy Markdown
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (commit 1)

public static string ReplaceLineEndings(this string input)
{
#if NET6_0_OR_GREATER
return input.ReplaceLineEndings();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is used only in tests, then I guess it's fine. But otherwise, our pattern is to have the method available always for binary compatibility: https://github.com/dotnet/roslyn/blob/main/docs/contributing/target-framework-strategy.md#pattern-for-extension-methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants