-
Notifications
You must be signed in to change notification settings - Fork 564
Closed
Labels
needs-triageIssues that need to be assigned.Issues that need to be assigned.
Description
Android framework version
net10.0-android (Preview)
Description
In the Xamarin.Android.Build.Tasks sources, we call the String.Compare method multiple times, repeating the same parameters. This runs counter to the DRY (Don't Repeat Yourself) principle and we should replace those calls with a helper method.
To do this, follow these steps:
- Find all
String.Comparecalls in the src/Xamarin.Android.Build.Tasks/Tasks/ and src/Xamarin.Android.Build.Tasks/Utilities/ directories, scanning all the .cs files. - Generate a helper method in the MonoAndroidHelper class which will replace the calls found in above.
The helper method must accept two string arguments and an argument specifying the mode of comparison, with default value set to StringComparison.OrdinalIgnoreCase. It will callString.Equalson one of the strings, passing the other as parameter together with comparison mode. Make sure none of the strings are null before using it.
The method will return a bool value indicating whether comparison was successful or not.
Place the helper method in the src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.Basic.cs file - Replace all
String.Comparecalls with a call to the new helper method, omitting comparison mode argument unless it's different to StringComparison.OrdinalIgnoreCase.
Copilot
Metadata
Metadata
Assignees
Labels
needs-triageIssues that need to be assigned.Issues that need to be assigned.