-
Notifications
You must be signed in to change notification settings - Fork 564
[XABT] Replace String.Compare calls with a common helper method #10274
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
Conversation
…er method Co-authored-by: grendello <[email protected]>
|
@copilot it seems |
…inal Co-authored-by: grendello <[email protected]>
Updated |
|
@copilot remove explicit |
…gEquals calls Co-authored-by: grendello <[email protected]>
Removed explicit |
| first.Substring (0, firstRootLength), | ||
| second.Substring (0, firstRootLength), | ||
| comparisonType); | ||
| } |
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.
@copilot Revert this change. The code is used in xaprepare which doesn't reference XABT
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.
Reverted PathUtil.cs to use original String.Compare implementation since it's used by xaprepare which doesn't reference XABT. Commit 9a6d7f0.
Co-authored-by: grendello <[email protected]>
| [Test] | ||
| public void TestStringEquals_DefaultComparison () | ||
| { | ||
| // Test default comparison (Ordinal) | ||
| Assert.IsTrue (MonoAndroidHelper.StringEquals ("Hello", "Hello")); | ||
| Assert.IsFalse (MonoAndroidHelper.StringEquals ("Hello", "hello")); | ||
| Assert.IsFalse (MonoAndroidHelper.StringEquals ("WORLD", "world")); | ||
| Assert.IsTrue (MonoAndroidHelper.StringEquals ("", "")); | ||
| } |
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.
@copilot Remove this method, it is a duplicate
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.
Removed the duplicate TestStringEquals_DefaultComparison method. Commit a928f06.
…ndroidHelperTests Co-authored-by: grendello <[email protected]>
This PR replaces repetitive
String.Comparecalls throughout the Xamarin.Android.Build.Tasks codebase with a common helper method, following the DRY (Don't Repeat Yourself) principle.Changes Made
New Helper Method
MonoAndroidHelper.StringEqualsmethod inMonoAndroidHelper.Basic.csStringEquals(string? value1, string? value2, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)String.Equalsinternally for the actual comparisonStringComparison.OrdinalIgnoreCasefor most common use caseString.Compare Replacements
String.Comparecalls (96.9% replacement rate)intreturn values for sorting operationsFiles Modified
MonoAndroidHelperTests.csTesting
Benefits
Fixes #10273.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.