I want to do this in a code that only occupies one line, anyone who can help me would be great.
long processSize = 0;
Process bProcess = null;
foreach (var process in Process.GetProcessesByName(name).Where(x => x.PagedMemorySize64 > processSize))
{
processSize = process.PagedMemorySize64;
bProcess = process;
}
FindProcess.Invoke(null, new ProcessEventArgs(bProcess));
There are several things to mark
I wouldn't advise doing it in one line because the code is horrible, unmaintainable and unclear, but you could do something like this:
separating the code in several lines is not wrong