How To Delete Variables?
I'm writing a some kind of Terminal in C#. So, the Program has a lot of methods, about 500 just now, in the future will be few thousand. Every method callable with a specific command. If I call a command, the method ran, but after that, the variable's value still there. If you use this Program for a long time(15-30 minutes), the whole computer will be lagging. I tried the Garbage Collector, didn't helped. So, how can I delete the method's variables, after the method has been ran? Example Method: public static void get_processes() { Process[] processes = Process.GetProcesses(); Console.WriteLine("PID:\tName:"); foreach (var process in processes) { string prc = process.ToString(); Console.WriteLine(process.Id + "\t" + prc.ToString().Substring(prc.IndexOf('(') + 1, prc.Length - prc.IndexOf('(') - 2)); } }