Repository: dotnet/runtime
File: src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs (C#)

Code before:
#else
                catch (Exception e)
                {
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.Error.WriteLine("Error: " + e.Message);
                    Console.Error.WriteLine(e.ToString());

                    Console.ResetColor();
                }

                return 1;
#endif
            });
        }

        public static void PrintExtendedHelp(ParseResult _)
        {
            Console.WriteLine(SR.OptionPassingHelp);
            Console.WriteLine();
            Console.WriteLine(SR.DashDashHelp);
            Console.WriteLine();

            string[] ValidArchitectures = new string[] {"arm", "armel", "arm64", "x86", "x64", "riscv64", "loongarch64", "wasm"};
            string[] ValidOS = new string[] {"windows", "linux", "osx", "ios", "iossimulator", "maccatalyst", "wasi"};

            Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant()));
            Console.WriteLine();
            Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetarch", String.Join("', '", ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));
            Console.WriteLine();
            Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--type-validation", String.Join("', '", Enum.GetNames<TypeValidationRule>()), nameof(TypeValidationRule.Automatic)));
            Console.WriteLine();

            Console.WriteLine(SR.CrossModuleInliningExtraHelp);
            Console.WriteLine();
            Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--method-layout", String.Join("', '", Enum.GetNames<MethodLayoutAlgorithm>())));
            Console.WriteLine();
            Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--file-layout", String.Join("', '", Enum.GetNames<FileLayoutAlgorithm>())));
            Console.WriteLine();

            Console.WriteLine(SR.InstructionSetHelp);
            foreach (string arch in ValidArchitectures)
            {
                TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch);
                bool first = true;
                foreach (var instructionSet in Internal.JitInterface.InstructionSetFlags.ArchitectureToValidInstructionSets(targetArch).DistinctBy((instructionSet) => instructionSet.Name, StringComparer.OrdinalIgnoreCase))
                {
                    // Only instruction sets with are specifiable should be printed to the help text
                    if (instructionSet.Specifiable)
                    {

Review comment (suggestion):
These can use collection expression:
```suggestion
            string[] ValidArchitectures = ["arm", "armel", "arm64", "x86", "x64", "riscv64", "loongarch64", "wasm"];
            string[] ValidOS = ["windows", "linux", "osx", "ios", "iossimulator", "maccatalyst", "wasi"];
```

Code after:
#else
                catch (Exception e)
                {
                    Console.ResetColor();
                    Console.ForegroundColor = ConsoleColor.Red;

                    Console.Error.WriteLine("Error: " + e.Message);
                    Console.Error.WriteLine(e.ToString());

                    Console.ResetColor();
                }

                return 1;
#endif
            });
        }

        public static void PrintExtendedHelp(ParseResult _)
        {
            Console.WriteLine(SR.OptionPassingHelp);
            Console.WriteLine();
            Console.WriteLine(SR.DashDashHelp);
            Console.WriteLine();

            string[] ValidArchitectures = ["arm", "armel", "arm64", "x86", "x64", "riscv64", "loongarch64", "wasm"];
            string[] ValidOS = ["windows", "linux", "osx", "ios", "iossimulator", "maccatalyst", "browser"];

            Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetos", String.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant()));
            Console.WriteLine();
            Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--targetarch", String.Join("', '", ValidArchitectures), Helpers.GetTargetArchitecture(null).ToString().ToLowerInvariant()));
            Console.WriteLine();
            Console.WriteLine(String.Format(SR.SwitchWithDefaultHelp, "--type-validation", String.Join("', '", Enum.GetNames<TypeValidationRule>()), nameof(TypeValidationRule.Automatic)));
            Console.WriteLine();

            Console.WriteLine(SR.CrossModuleInliningExtraHelp);
            Console.WriteLine();
            Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--method-layout", String.Join("', '", Enum.GetNames<MethodLayoutAlgorithm>())));
            Console.WriteLine();
            Console.WriteLine(String.Format(SR.LayoutOptionExtraHelp, "--file-layout", String.Join("', '", Enum.GetNames<FileLayoutAlgorithm>())));
            Console.WriteLine();

            Console.WriteLine(SR.InstructionSetHelp);
            foreach (string arch in ValidArchitectures)
            {
                TargetArchitecture targetArch = Helpers.GetTargetArchitecture(arch);
                bool first = true;
                foreach (var instructionSet in Internal.JitInterface.InstructionSetFlags.ArchitectureToValidInstructionSets(targetArch).DistinctBy((instructionSet) => instructionSet.Name, StringComparer.OrdinalIgnoreCase))
                {
                    // Only instruction sets with are specifiable should be printed to the help text
                    if (instructionSet.Specifiable)
                    {