-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Refactorings in preparation of .NET 9.0 support #16575
Conversation
This pull request has merge conflicts. Please resolve those before requesting a review. |
[ci-skip] Co-authored-by: Georg von Kries <[email protected]>
@@ -356,6 +358,19 @@ public static string TrimEnd(this string value, string trim = "") | |||
? value[..^trim.Length] | |||
: value; | |||
} | |||
#endif | |||
|
|||
public static string TrimEndString(this string value, string suffix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please elaborate what are the different behaviors?
In both cases, we can have the same name and move #if .. #elseif .. #endif inside the function, this way no need to have a new method name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TrimEnd
exists in net9.0, so we need to hide it when we build in net9.0.
And in net9.0 TrimEnd("Part")
is equivalent to TrimEnd(new char[] { 'P', 'a', 'r', 't' })
so "MenuListPart"
would become "MenuLis"
without the t
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a new overload has been added in .NET 9.0
Changes that would have to be made when supporting .NET 9 and can/should come in 2.0 release instead
This way the .NET 9 branch is only about .NET 9 changes