C # Process.Modules is very slow
My code is retrieving all loaded module names from each running process, my approach is similar to this answer .
Here is my code:
Process[] procs = Process.GetProcesses();
foreach (Process p in procs)
{
foreach (ProcessModule item in p.Modules)
{
Console.WriteLine(item.FileName);
}
}
For some reason this approach has very poor performance :(
Is there any other method or approach to get the names of all these modules?
Any other solution that will run faster than this would be great
TIA
+3
source to share