Repository: dotnet/runtime
File: src/libraries/System.Text.Encoding.CodePages/src/System/Text/EncodingTable.cs (C#)

Code before:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Concurrent;
using System.Diagnostics;

namespace System.Text
{
    internal static partial class EncodingTable
    {
        private static readonly ConcurrentDictionary<string, int> s_nameToCodePageCache = new ConcurrentDictionary<string, int>(StringComparer.OrdinalIgnoreCase);
        private static readonly ConcurrentDictionary<int, string> s_codePageToWebNameCache = new ConcurrentDictionary<int, string>();
        private static readonly ConcurrentDictionary<int, string> s_codePageToEnglishNameCache = new ConcurrentDictionary<int, string>();
        private static readonly ConcurrentDictionary<int, (ushort FamilyCodePage, byte CodePageFlags)> s_codePageToItemCache = new ConcurrentDictionary<int, (ushort FamilyCodePage, byte CodePageFlags)>();

        internal static (ushort FamilyCodePage, byte CodePageFlags) GetCodePageItem(int codePage)
        {
            if (s_codePageToItemCache.TryGetValue(codePage, out (ushort FamilyCodePage, byte CodePageFlags) item))
            {
                return item;
            }

            int i = MappedCodePages.IndexOf((ushort)codePage);
            if (i < 0)
            {
                return ((ushort)codePage, (byte)0);
            }

            item = (MappedFamilyCodePage[i], MappedFlags[i]);
            s_codePageToItemCache.TryAdd(codePage, item);

            return item;
        }

        internal static int GetCodePageFromName(string name)
        {
            if (name is null)
                return 0;


Review comment (suggestion):
@copilot these `new`s can be simplified, e.g. `new(StringComparer.OrdinalIgnoreCase)` when a comparer is needed or `new()` when one isn't.

Code after:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Concurrent;
using System.Diagnostics;

namespace System.Text
{
    internal static partial class EncodingTable
    {
        private static readonly ConcurrentDictionary<string, int> s_nameToCodePageCache = new(StringComparer.OrdinalIgnoreCase);
        private static readonly ConcurrentDictionary<int, string> s_codePageToWebNameCache = new();
        private static readonly ConcurrentDictionary<int, string> s_codePageToEnglishNameCache = new();
        private static readonly ConcurrentDictionary<int, (ushort FamilyCodePage, byte CodePageFlags)> s_codePageToItemCache = new();

        internal static (ushort FamilyCodePage, byte CodePageFlags) GetCodePageItem(int codePage)
        {
            if (s_codePageToItemCache.TryGetValue(codePage, out (ushort FamilyCodePage, byte CodePageFlags) item))
            {
                return item;
            }

            int i = MappedCodePages.IndexOf((ushort)codePage);
            if (i < 0)
            {
                return ((ushort)codePage, (byte)0);
            }

            item = (MappedFamilyCodePage[i], MappedFlags[i]);
            s_codePageToItemCache.TryAdd(codePage, item);

            return item;
        }

        internal static int GetCodePageFromName(string name)
        {
            if (name is null)
            {
                return 0;