반응형
        private static int CompareProcessId(Process p1, Process p2)
        {
            if (p1.Id == p2.Id) return 0;
            else if (p1.Id > p2.Id) return 1;
            else return -1;
        }

        private static int CompareProcessName(Process p1, Process p2)
        {
            return p1.ProcessName.CompareTo(p2.ProcessName);
        }
            Process[] processCollection = Process.GetProcesses();
            Comparison<Process> processComparer = new Comparison<Process>(CompareProcessName);
            List<Process> sortedProcess = processCollection.ToList();
            sortedProcess.Sort(processComparer);
            processCollection = sortedProcess.ToArray();
반응형

+ Recent posts