Repository: PowerShell/PowerShell
File: src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs (C#)

Code before:
                // Start-Process & Get-Command select first found application based on PATHEXT environment variable
                if (commands.Count >= 1)
                {
                    foreach (CompletionResult result in CompleteFileVerbs(commands[0].Source, wordToComplete))
                    {
                        yield return result;
                    }
                }
            }
        }

        /// <summary>
        /// Completes file verbs.
        /// </summary>
        /// <param name="filePath">The file path to get verbs.</param>
        /// <param name="wordToComplete">The word to complete.</param>
        /// <returns>List of file verbs to complete.</returns>
        private static IEnumerable<CompletionResult> CompleteFileVerbs(string filePath, string wordToComplete)
        {
            string[] verbs = new ProcessStartInfo(filePath).Verbs;

            foreach (CompletionResult result in CompletionCompleters.EnumerateQuotedAndUnquotedCompletionText(
                wordToComplete,
                possibleCompletionValues: verbs))
            {
                yield return result;
            }
        }
    }

#if !UNIX
    /// <summary>
    /// ProcessCollection is a helper class used by Start-Process -Wait cmdlet to monitor the
    /// child processes created by the main process hosted by the Start-process cmdlet.
    /// </summary>
    internal class ProcessCollection
    {
        /// <summary>
        /// JobObjectHandle is a reference to the job object used to track
        /// the child processes created by the main process hosted by the Start-Process cmdlet.
        /// </summary>
        private readonly Microsoft.PowerShell.Commands.SafeJobHandle _jobObjectHandle;

        /// <summary>
        /// ProcessCollection constructor.
        /// </summary>
        internal ProcessCollection()
        {
            IntPtr jobObjectHandleIntPtr = NativeMethods.CreateJobObject(IntPtr.Zero, null);
            _jobObjectHandle = new SafeJobHandle(jobObjectHandleIntPtr);
        }

Review comment (suggestion):
We can return `CompletionCompleters.EnumerateQuotedAndUnquotedCompletionText()` because there aren't other yield-s.

Code after:
        /// <param name="wordToComplete">The word to complete.</param>
        /// <param name="filePath">The file path to get verbs.</param>
        /// <returns>List of file verbs to complete.</returns>
        private static IEnumerable<CompletionResult> CompleteFileVerbs(string wordToComplete, string filePath)
            => CompletionCompleters.GetMatchingResults(
                wordToComplete,
                possibleCompletionValues: new ProcessStartInfo(filePath).Verbs);
    }

#if !UNIX
    /// <summary>
    /// ProcessInformation is a helper class that wraps the native PROCESS_INFORMATION structure
    /// returned by CreateProcess or CreateProcessWithLogon. It ensures the process and thread
    /// HANDLEs are disposed once it's not needed.
    /// </summary>
    internal sealed class ProcessInformation : IDisposable
    {
        public SafeProcessHandle Process { get; }

        public SafeProcessHandle Thread { get; }

        public Int32 ProcessId { get; }

        public Int32 ThreadId { get; }

        internal ProcessInformation(ProcessNativeMethods.PROCESS_INFORMATION info)
        {
            Process = new(info.hProcess, true);
            Thread = new(info.hThread, true);
            ProcessId = info.dwProcessId;
            ThreadId = info.dwThreadId;
        }

        public void Resume()
        {
            ProcessNativeMethods.ResumeThread(Thread.DangerousGetHandle());
        }

        public void Dispose()
        {
            Process.Dispose();
            Thread.Dispose();
            GC.SuppressFinalize(this);
        }

        ~ProcessInformation() => Dispose();
    }

    internal static class ProcessNativeMethods
    {
        [DllImport(PinvokeDllNames.CreateProcessWithLogonWDllName, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]