From 6bb37921b6f289a6728e1855e4ebfce82aed6c93 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Tue, 30 May 2023 14:25:59 +0100 Subject: [PATCH] Revert "[core] use StringComparer for Dictionary/HashSet (#14900)" This reverts commit 3a8455a83e74a9c20d0173aaf4374a11896caf58. --- .../src/Maui/Tizen/BlazorWebViewHandler.Tizen.cs | 2 +- src/BlazorWebView/src/Maui/Windows/StaticContentProvider.cs | 2 +- .../Core/src/Android/Renderers/FormsVideoView.cs | 2 +- .../Core/src/Tizen/Renderers/VisualElementRenderer.cs | 4 ++-- src/Compatibility/Core/src/WPF/Extensions/FontExtensions.cs | 2 +- src/Controls/src/Build.Tasks/PerformanceProvider.cs | 2 +- src/Controls/src/Core/AppLinkEntry.cs | 2 +- src/Controls/src/Core/Application.cs | 2 +- src/Controls/src/Core/DragAndDrop/DataPackagePropertySet.cs | 3 +-- .../src/Core/HandlerImpl/Application/Application.Impl.cs | 2 +- src/Controls/src/Core/Internals/NameScope.cs | 2 +- src/Controls/src/Core/Registrar.cs | 4 ++-- src/Controls/src/Core/ResourceDictionary.cs | 2 +- src/Controls/src/Core/ResourcesExtensions.cs | 4 ++-- src/Controls/src/Core/Routing.cs | 4 ++-- src/Controls/src/Core/Shell/ShellNavigationManager.cs | 2 +- src/Controls/src/Core/StyleSheets/Style.cs | 2 +- src/Controls/src/Core/VisualElement.cs | 2 +- src/Controls/src/Core/VisualStateManager.cs | 2 +- src/Controls/src/Xaml/XamlServiceProvider.cs | 2 +- src/Core/src/CommandMapper.cs | 2 +- src/Core/src/Fonts/FontRegistrar.cs | 6 +++--- src/Core/src/HotReload/HotReloadHelper.cs | 4 ++-- src/Core/src/LifecycleEvents/LifecycleEventService.cs | 2 +- src/Core/src/PropertyMapper.cs | 2 +- src/Core/src/WeakEventManager.cs | 2 +- src/Essentials/src/TextToSpeech/TextToSpeech.android.cs | 2 +- src/Essentials/src/Types/Shared/WebUtils.shared.cs | 2 +- .../src/VersionTracking/VersionTracking.shared.cs | 4 ++-- .../src/WebAuthenticator/WebAuthenticatorResult.shared.cs | 2 +- src/Graphics/src/Graphics/Text/TextColors.cs | 4 ++-- src/Graphics/src/Text.Markdig/Renderer/SimpleCssParser.cs | 2 +- src/SingleProject/Resizetizer/src/ResizetizeImages.cs | 2 +- .../Resizetizer/src/TizenResourceXmlGenerator.cs | 5 ++--- 34 files changed, 44 insertions(+), 46 deletions(-) diff --git a/src/BlazorWebView/src/Maui/Tizen/BlazorWebViewHandler.Tizen.cs b/src/BlazorWebView/src/Maui/Tizen/BlazorWebViewHandler.Tizen.cs index c6f5d1fa59f1..5f5c9b511166 100644 --- a/src/BlazorWebView/src/Maui/Tizen/BlazorWebViewHandler.Tizen.cs +++ b/src/BlazorWebView/src/Maui/Tizen/BlazorWebViewHandler.Tizen.cs @@ -45,7 +45,7 @@ public partial class BlazorWebViewHandler : ViewHandler> s_webviewHandlerTable = new(StringComparer.Ordinal); + static private Dictionary> s_webviewHandlerTable = new Dictionary>(); private TizenWebViewManager? _webviewManager; diff --git a/src/BlazorWebView/src/Maui/Windows/StaticContentProvider.cs b/src/BlazorWebView/src/Maui/Windows/StaticContentProvider.cs index 6e770f204208..a25e0613edb3 100644 --- a/src/BlazorWebView/src/Maui/Windows/StaticContentProvider.cs +++ b/src/BlazorWebView/src/Maui/Windows/StaticContentProvider.cs @@ -24,7 +24,7 @@ internal static string GetResponseContentTypeOrDefault(string path) : "application/octet-stream"; internal static IDictionary GetResponseHeaders(string contentType) - => new Dictionary(StringComparer.Ordinal) + => new Dictionary() { { "Content-Type", contentType }, { "Cache-Control", "no-cache, max-age=0, must-revalidate, no-store" }, diff --git a/src/Compatibility/Core/src/Android/Renderers/FormsVideoView.cs b/src/Compatibility/Core/src/Android/Renderers/FormsVideoView.cs index 844c072aa33f..0c32b1a8b254 100644 --- a/src/Compatibility/Core/src/Android/Renderers/FormsVideoView.cs +++ b/src/Compatibility/Core/src/Android/Renderers/FormsVideoView.cs @@ -67,7 +67,7 @@ public override void SetVideoURI(global::Android.Net.Uri uri, IDictionary(StringComparer.Ordinal)); + GetMetaData(uri, new Dictionary()); base.SetVideoURI(uri); } diff --git a/src/Compatibility/Core/src/Tizen/Renderers/VisualElementRenderer.cs b/src/Compatibility/Core/src/Tizen/Renderers/VisualElementRenderer.cs index 21b7d6d6eb30..316657eed71a 100644 --- a/src/Compatibility/Core/src/Tizen/Renderers/VisualElementRenderer.cs +++ b/src/Compatibility/Core/src/Tizen/Renderers/VisualElementRenderer.cs @@ -25,9 +25,9 @@ public abstract class VisualElementRenderer : IVisualElementRenderer, { event EventHandler _elementChanged; - readonly Dictionary> _propertyHandlersWithInit = new(StringComparer.Ordinal); + readonly Dictionary> _propertyHandlersWithInit = new Dictionary>(); - readonly Dictionary _propertyHandlers = new(StringComparer.Ordinal); + readonly Dictionary _propertyHandlers = new Dictionary(); readonly HashSet _batchedProperties = new HashSet(); diff --git a/src/Compatibility/Core/src/WPF/Extensions/FontExtensions.cs b/src/Compatibility/Core/src/WPF/Extensions/FontExtensions.cs index 07b87fb3134f..1c1bbfa674c9 100644 --- a/src/Compatibility/Core/src/WPF/Extensions/FontExtensions.cs +++ b/src/Compatibility/Core/src/WPF/Extensions/FontExtensions.cs @@ -114,7 +114,7 @@ internal static bool IsDefault(this IFontElement self) return self.FontFamily == null && self.FontSize == Device.GetNamedSize(NamedSize.Default, typeof(Label), true) && self.FontAttributes == FontAttributes.None; } - static Dictionary FontFamilies = new(StringComparer.Ordinal); + static Dictionary FontFamilies = new Dictionary(); public static FontFamily ToFontFamily(this string fontFamily, string defaultFontResource = "FontFamilySemiBold") diff --git a/src/Controls/src/Build.Tasks/PerformanceProvider.cs b/src/Controls/src/Build.Tasks/PerformanceProvider.cs index c96f7ce074ac..968bebba79e6 100644 --- a/src/Controls/src/Build.Tasks/PerformanceProvider.cs +++ b/src/Controls/src/Build.Tasks/PerformanceProvider.cs @@ -18,7 +18,7 @@ internal class Statistic public bool IsDetail; } - readonly Dictionary _Statistics = new(StringComparer.Ordinal); + readonly Dictionary _Statistics = new Dictionary(); public Dictionary Statistics { diff --git a/src/Controls/src/Core/AppLinkEntry.cs b/src/Controls/src/Core/AppLinkEntry.cs index 83900ac65506..8eaf4b4863f6 100644 --- a/src/Controls/src/Core/AppLinkEntry.cs +++ b/src/Controls/src/Core/AppLinkEntry.cs @@ -12,7 +12,7 @@ public class AppLinkEntry : Element, IAppLinkEntry /// public AppLinkEntry() { - keyValues = new(StringComparer.Ordinal); + keyValues = new Dictionary(); } /// Bindable property for . diff --git a/src/Controls/src/Core/Application.cs b/src/Controls/src/Core/Application.cs index 49747ad00b98..60214eacac18 100644 --- a/src/Controls/src/Core/Application.cs +++ b/src/Controls/src/Core/Application.cs @@ -327,7 +327,7 @@ internal override void OnParentResourcesChanged(IEnumerable(StringComparer.Ordinal); + var innerKeys = new HashSet(); var changedResources = new List>(); foreach (KeyValuePair c in Resources) innerKeys.Add(c.Key); diff --git a/src/Controls/src/Core/DragAndDrop/DataPackagePropertySet.cs b/src/Controls/src/Core/DragAndDrop/DataPackagePropertySet.cs index ea668eede3c2..dcbf398fdec0 100644 --- a/src/Controls/src/Core/DragAndDrop/DataPackagePropertySet.cs +++ b/src/Controls/src/Core/DragAndDrop/DataPackagePropertySet.cs @@ -1,5 +1,4 @@ #nullable disable -using System; using System.Collections; using System.Collections.Generic; @@ -13,7 +12,7 @@ public class DataPackagePropertySet : IEnumerable /// public DataPackagePropertySet() { - _propertyBag = new(StringComparer.Ordinal); + _propertyBag = new Dictionary(); } public object this[string key] diff --git a/src/Controls/src/Core/HandlerImpl/Application/Application.Impl.cs b/src/Controls/src/Core/HandlerImpl/Application/Application.Impl.cs index 30b82d078ea1..9ac7e6c59aba 100644 --- a/src/Controls/src/Core/HandlerImpl/Application/Application.Impl.cs +++ b/src/Controls/src/Core/HandlerImpl/Application/Application.Impl.cs @@ -13,7 +13,7 @@ public partial class Application : IApplication internal const string MauiWindowIdKey = "__MAUI_WINDOW_ID__"; readonly List _windows = new(); - readonly Dictionary> _requestedWindows = new(StringComparer.Ordinal); + readonly Dictionary> _requestedWindows = new(); ILogger? _logger; ILogger? Logger => diff --git a/src/Controls/src/Core/Internals/NameScope.cs b/src/Controls/src/Core/Internals/NameScope.cs index d86031f406c6..3a06efd436dd 100644 --- a/src/Controls/src/Core/Internals/NameScope.cs +++ b/src/Controls/src/Core/Internals/NameScope.cs @@ -14,7 +14,7 @@ public class NameScope : INameScope public static readonly BindableProperty NameScopeProperty = BindableProperty.CreateAttached("NameScope", typeof(INameScope), typeof(NameScope), default(INameScope)); - readonly Dictionary _names = new(StringComparer.Ordinal); + readonly Dictionary _names = new Dictionary(); readonly Dictionary _values = new Dictionary(); object INameScope.FindByName(string name) diff --git a/src/Controls/src/Core/Registrar.cs b/src/Controls/src/Core/Registrar.cs index 60bd68a1528c..5022ca1c7489 100644 --- a/src/Controls/src/Core/Registrar.cs +++ b/src/Controls/src/Core/Registrar.cs @@ -272,7 +272,7 @@ static Registrar() Registered = new Registrar(); } - internal static Dictionary Effects { get; } = new(StringComparer.Ordinal); + internal static Dictionary Effects { get; } = new Dictionary(); internal static Dictionary> StyleProperties => LazyStyleProperties.Value; @@ -319,7 +319,7 @@ public static void RegisterStylesheets(InitializationFlags flags) static Dictionary> LoadStyleSheets() { - var properties = new Dictionary>(StringComparer.Ordinal); + var properties = new Dictionary>(); if (DisableCSS) return properties; var assembly = typeof(StylePropertyAttribute).Assembly; diff --git a/src/Controls/src/Core/ResourceDictionary.cs b/src/Controls/src/Core/ResourceDictionary.cs index 590e66e34a9d..5ab3a2dc752a 100644 --- a/src/Controls/src/Core/ResourceDictionary.cs +++ b/src/Controls/src/Core/ResourceDictionary.cs @@ -20,7 +20,7 @@ public class ResourceDictionary : IResourceDictionary, IDictionary s_instances = new ConditionalWeakTable(); - readonly Dictionary _innerDictionary = new(StringComparer.Ordinal); + readonly Dictionary _innerDictionary = new Dictionary(); ResourceDictionary _mergedInstance; Uri _source; diff --git a/src/Controls/src/Core/ResourcesExtensions.cs b/src/Controls/src/Core/ResourcesExtensions.cs index ce0a2df4e90a..f0f2677cf4ec 100644 --- a/src/Controls/src/Core/ResourcesExtensions.cs +++ b/src/Controls/src/Core/ResourcesExtensions.cs @@ -14,7 +14,7 @@ public static IEnumerable> GetMergedResources(this var ve = element as IResourcesProvider; if (ve != null && ve.IsResourcesCreated) { - resources = resources ?? new(StringComparer.Ordinal); + resources = resources ?? new Dictionary(); foreach (KeyValuePair res in ve.Resources.MergedResources) { // If a MergedDictionary value is overridden for a DynamicResource, @@ -33,7 +33,7 @@ public static IEnumerable> GetMergedResources(this var app = element as Application; if (app != null && app.SystemResources != null) { - resources = resources ?? new Dictionary(8, StringComparer.Ordinal); + resources = resources ?? new Dictionary(8); foreach (KeyValuePair res in app.SystemResources) if (!resources.ContainsKey(res.Key)) resources.Add(res.Key, res.Value); diff --git a/src/Controls/src/Core/Routing.cs b/src/Controls/src/Core/Routing.cs index a1c01857aae0..c96af18b3d71 100644 --- a/src/Controls/src/Core/Routing.cs +++ b/src/Controls/src/Core/Routing.cs @@ -11,8 +11,8 @@ namespace Microsoft.Maui.Controls public static class Routing { static int s_routeCount = 0; - static Dictionary s_routes = new(StringComparer.Ordinal); - static Dictionary s_implicitPageRoutes = new(StringComparer.Ordinal); + static Dictionary s_routes = new Dictionary(); + static Dictionary s_implicitPageRoutes = new Dictionary(); static HashSet s_routeKeys; const string ImplicitPrefix = "IMPL_"; diff --git a/src/Controls/src/Core/Shell/ShellNavigationManager.cs b/src/Controls/src/Core/Shell/ShellNavigationManager.cs index 986684000caa..a762a925fd45 100644 --- a/src/Controls/src/Core/Shell/ShellNavigationManager.cs +++ b/src/Controls/src/Core/Shell/ShellNavigationManager.cs @@ -492,7 +492,7 @@ static Dictionary ParseQueryString(string query) { if (query.StartsWith("?", StringComparison.Ordinal)) query = query.Substring(1); - Dictionary lookupDict = new(StringComparer.Ordinal); + Dictionary lookupDict = new Dictionary(); if (query == null) return lookupDict; foreach (var part in query.Split('&')) diff --git a/src/Controls/src/Core/StyleSheets/Style.cs b/src/Controls/src/Core/StyleSheets/Style.cs index aac7cec0b463..61d666a51614 100644 --- a/src/Controls/src/Core/StyleSheets/Style.cs +++ b/src/Controls/src/Core/StyleSheets/Style.cs @@ -14,7 +14,7 @@ sealed class Style { } - public IDictionary Declarations { get; set; } = new Dictionary(StringComparer.Ordinal); + public IDictionary Declarations { get; set; } = new Dictionary(); Dictionary, object> convertedValues = new Dictionary, object>(); public static Style Parse(CssReader reader, char stopChar = '\0') diff --git a/src/Controls/src/Core/VisualElement.cs b/src/Controls/src/Core/VisualElement.cs index 8439cc244eef..191d08f10cec 100644 --- a/src/Controls/src/Core/VisualElement.cs +++ b/src/Controls/src/Core/VisualElement.cs @@ -1139,7 +1139,7 @@ internal override void OnParentResourcesChanged(IEnumerable(StringComparer.Ordinal); + var innerKeys = new HashSet(); var changedResources = new List>(); foreach (KeyValuePair c in Resources) innerKeys.Add(c.Key); diff --git a/src/Controls/src/Core/VisualStateManager.cs b/src/Controls/src/Core/VisualStateManager.cs index 48724c767980..cb667ce0951d 100644 --- a/src/Controls/src/Core/VisualStateManager.cs +++ b/src/Controls/src/Core/VisualStateManager.cs @@ -153,7 +153,7 @@ public class VisualStateGroupList : IList // Used to check for duplicate names; we keep it around because it's cheaper to create it once and clear it // than to create one every time we need to validate - readonly HashSet _names = new HashSet(StringComparer.Ordinal); + readonly HashSet _names = new HashSet(); void Validate(IList groups) { diff --git a/src/Controls/src/Xaml/XamlServiceProvider.cs b/src/Controls/src/Xaml/XamlServiceProvider.cs index 23bf38738b32..9385be504dcc 100644 --- a/src/Controls/src/Xaml/XamlServiceProvider.cs +++ b/src/Controls/src/Xaml/XamlServiceProvider.cs @@ -271,7 +271,7 @@ public object FindByName(string name) public class XmlNamespaceResolver : IXmlNamespaceResolver { - readonly Dictionary namespaces = new Dictionary(StringComparer.Ordinal); + readonly Dictionary namespaces = new Dictionary(); public IDictionary GetNamespacesInScope(XmlNamespaceScope scope) => throw new NotImplementedException(); diff --git a/src/Core/src/CommandMapper.cs b/src/Core/src/CommandMapper.cs index c5dbd8a2422e..52eaf02d3c81 100644 --- a/src/Core/src/CommandMapper.cs +++ b/src/Core/src/CommandMapper.cs @@ -6,7 +6,7 @@ namespace Microsoft.Maui { public abstract class CommandMapper : ICommandMapper { - readonly Dictionary _mapper = new(StringComparer.Ordinal); + readonly Dictionary _mapper = new(); CommandMapper? _chained; diff --git a/src/Core/src/Fonts/FontRegistrar.cs b/src/Core/src/Fonts/FontRegistrar.cs index 962322bc0ab2..1e62c3189ced 100644 --- a/src/Core/src/Fonts/FontRegistrar.cs +++ b/src/Core/src/Fonts/FontRegistrar.cs @@ -10,9 +10,9 @@ namespace Microsoft.Maui /// public partial class FontRegistrar : IFontRegistrar { - readonly Dictionary _embeddedFonts = new(StringComparer.Ordinal); - readonly Dictionary _nativeFonts = new(StringComparer.Ordinal); - readonly Dictionary _fontLookupCache = new(StringComparer.Ordinal); + readonly Dictionary _embeddedFonts = new(); + readonly Dictionary _nativeFonts = new(); + readonly Dictionary _fontLookupCache = new(); readonly IServiceProvider? _serviceProvider; IEmbeddedFontLoader _fontLoader; diff --git a/src/Core/src/HotReload/HotReloadHelper.cs b/src/Core/src/HotReload/HotReloadHelper.cs index 41d2f622aa1a..4de9c4ebc680 100644 --- a/src/Core/src/HotReload/HotReloadHelper.cs +++ b/src/Core/src/HotReload/HotReloadHelper.cs @@ -88,9 +88,9 @@ static void TransferState(IHotReloadableView oldView, IView newView) } static internal readonly WeakList ActiveViews = new WeakList(); - static Dictionary replacedViews = new(StringComparer.Ordinal); + static Dictionary replacedViews = new Dictionary(); static Dictionary currentViews = new Dictionary(); - static Dictionary>> replacedHandlers = new(StringComparer.Ordinal); + static Dictionary>> replacedHandlers = new Dictionary>>(); public static void RegisterReplacedView(string oldViewType, Type newViewType) { if (!IsEnabled) diff --git a/src/Core/src/LifecycleEvents/LifecycleEventService.cs b/src/Core/src/LifecycleEvents/LifecycleEventService.cs index e861166f2798..40c2d0d07879 100644 --- a/src/Core/src/LifecycleEvents/LifecycleEventService.cs +++ b/src/Core/src/LifecycleEvents/LifecycleEventService.cs @@ -6,7 +6,7 @@ namespace Microsoft.Maui.LifecycleEvents { public class LifecycleEventService : ILifecycleEventService, ILifecycleBuilder { - readonly Dictionary> _mapper = new(StringComparer.Ordinal); + readonly Dictionary> _mapper = new Dictionary>(); public LifecycleEventService(IEnumerable registrations) { diff --git a/src/Core/src/PropertyMapper.cs b/src/Core/src/PropertyMapper.cs index 61bf26b5c92b..afc215ae2aee 100644 --- a/src/Core/src/PropertyMapper.cs +++ b/src/Core/src/PropertyMapper.cs @@ -15,7 +15,7 @@ namespace Microsoft.Maui { public abstract class PropertyMapper : IPropertyMapper { - protected readonly Dictionary> _mapper = new(StringComparer.Ordinal); + protected readonly Dictionary> _mapper = new(); IPropertyMapper[]? _chained; diff --git a/src/Core/src/WeakEventManager.cs b/src/Core/src/WeakEventManager.cs index be16cba8a43f..ed30b0c29fe9 100644 --- a/src/Core/src/WeakEventManager.cs +++ b/src/Core/src/WeakEventManager.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maui /// public class WeakEventManager { - readonly Dictionary> _eventHandlers = new(StringComparer.Ordinal); + readonly Dictionary> _eventHandlers = new Dictionary>(); /// public void AddEventHandler(EventHandler handler, [CallerMemberName] string eventName = "") diff --git a/src/Essentials/src/TextToSpeech/TextToSpeech.android.cs b/src/Essentials/src/TextToSpeech/TextToSpeech.android.cs index 8f2ce2d6eeb1..db4dfa2fd327 100644 --- a/src/Essentials/src/TextToSpeech/TextToSpeech.android.cs +++ b/src/Essentials/src/TextToSpeech/TextToSpeech.android.cs @@ -157,7 +157,7 @@ public async Task SpeakAsync(string text, int max, SpeechOptions options, Cancel for (var i = 0; i < parts.Count && !cancelToken.IsCancellationRequested; i++) { // We require the utterance id to be set if we want the completed listener to fire - var map = new Dictionary(StringComparer.Ordinal) + var map = new Dictionary { { AndroidTextToSpeech.Engine.KeyParamUtteranceId, $"{guid}.{i}" } }; diff --git a/src/Essentials/src/Types/Shared/WebUtils.shared.cs b/src/Essentials/src/Types/Shared/WebUtils.shared.cs index e454f06d4f55..169038b85100 100644 --- a/src/Essentials/src/Types/Shared/WebUtils.shared.cs +++ b/src/Essentials/src/Types/Shared/WebUtils.shared.cs @@ -10,7 +10,7 @@ static class WebUtils { internal static IDictionary ParseQueryString(string url) { - var d = new Dictionary(StringComparer.Ordinal); + var d = new Dictionary(); if (string.IsNullOrWhiteSpace(url) || (url.IndexOf("?", StringComparison.Ordinal) == -1 && url.IndexOf("#", StringComparison.Ordinal) == -1)) return d; diff --git a/src/Essentials/src/VersionTracking/VersionTracking.shared.cs b/src/Essentials/src/VersionTracking/VersionTracking.shared.cs index 3dfa506dc001..5de4ea4c3aca 100644 --- a/src/Essentials/src/VersionTracking/VersionTracking.shared.cs +++ b/src/Essentials/src/VersionTracking/VersionTracking.shared.cs @@ -238,7 +238,7 @@ internal void InitVersionTracking() IsFirstLaunchEver = !preferences.ContainsKey(versionsKey, sharedName) || !preferences.ContainsKey(buildsKey, sharedName); if (IsFirstLaunchEver) { - versionTrail = new(StringComparer.Ordinal) + versionTrail = new Dictionary> { { versionsKey, new List() }, { buildsKey, new List() } @@ -246,7 +246,7 @@ internal void InitVersionTracking() } else { - versionTrail = new(StringComparer.Ordinal) + versionTrail = new Dictionary> { { versionsKey, ReadHistory(versionsKey).ToList() }, { buildsKey, ReadHistory(buildsKey).ToList() } diff --git a/src/Essentials/src/WebAuthenticator/WebAuthenticatorResult.shared.cs b/src/Essentials/src/WebAuthenticator/WebAuthenticatorResult.shared.cs index c54b8cec919b..53a7ff72fb5a 100644 --- a/src/Essentials/src/WebAuthenticator/WebAuthenticatorResult.shared.cs +++ b/src/Essentials/src/WebAuthenticator/WebAuthenticatorResult.shared.cs @@ -73,7 +73,7 @@ public WebAuthenticatorResult(IDictionary properties) /// /// The dictionary of key/value pairs parsed form the callback URI's query string. /// - public Dictionary Properties { get; set; } = new(StringComparer.Ordinal); + public Dictionary Properties { get; set; } = new Dictionary(); /// Puts a key/value pair into the dictionary. public void Put(string key, string value) diff --git a/src/Graphics/src/Graphics/Text/TextColors.cs b/src/Graphics/src/Graphics/Text/TextColors.cs index dad031b51949..359651182812 100644 --- a/src/Graphics/src/Graphics/Text/TextColors.cs +++ b/src/Graphics/src/Graphics/Text/TextColors.cs @@ -6,7 +6,7 @@ namespace Microsoft.Maui.Graphics.Text { public static class TextColors { - public static Dictionary StandardColors = new(StringComparer.OrdinalIgnoreCase) + public static Dictionary StandardColors = new Dictionary { {"BLACK", "#000000"}, {"NAVY", "#000080"}, @@ -158,7 +158,7 @@ public static float[] Parse(this string color) //Remove # if present if (!color.StartsWith("#", StringComparison.Ordinal)) { - if (!StandardColors.TryGetValue(color, out color)) + if (!StandardColors.TryGetValue(color.ToUpperInvariant(), out color)) return null; } diff --git a/src/Graphics/src/Text.Markdig/Renderer/SimpleCssParser.cs b/src/Graphics/src/Text.Markdig/Renderer/SimpleCssParser.cs index e180f4334a1f..6f0ab117154a 100644 --- a/src/Graphics/src/Text.Markdig/Renderer/SimpleCssParser.cs +++ b/src/Graphics/src/Text.Markdig/Renderer/SimpleCssParser.cs @@ -10,7 +10,7 @@ public static Dictionary Parse(string css) if (string.IsNullOrEmpty(css)) return null; - var values = new Dictionary(StringComparer.Ordinal); + var values = new Dictionary(); var entries = css.Split(';'); foreach (var entry in entries) diff --git a/src/SingleProject/Resizetizer/src/ResizetizeImages.cs b/src/SingleProject/Resizetizer/src/ResizetizeImages.cs index a2b2fcba5374..746501e2bc2c 100644 --- a/src/SingleProject/Resizetizer/src/ResizetizeImages.cs +++ b/src/SingleProject/Resizetizer/src/ResizetizeImages.cs @@ -99,7 +99,7 @@ public override System.Threading.Tasks.Task ExecuteAsync() foreach (var img in resizedImages) { - var attr = new Dictionary(StringComparer.Ordinal); + var attr = new Dictionary(); string itemSpec = Path.GetFullPath(img.Filename); // Fix the item spec to be relative for mac diff --git a/src/SingleProject/Resizetizer/src/TizenResourceXmlGenerator.cs b/src/SingleProject/Resizetizer/src/TizenResourceXmlGenerator.cs index c5bae8c8e474..ff04a4efc68a 100644 --- a/src/SingleProject/Resizetizer/src/TizenResourceXmlGenerator.cs +++ b/src/SingleProject/Resizetizer/src/TizenResourceXmlGenerator.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using System.Xml; @@ -7,7 +6,7 @@ namespace Microsoft.Maui.Resizetizer { internal class TizenResourceXmlGenerator { - static readonly IDictionary resolutionMap = new Dictionary(StringComparer.Ordinal) + static readonly IDictionary resolutionMap = new Dictionary { { "LDPI", "from 0 to 240" }, { "MDPI", "from 241 to 300" },