This can be done using a foreach loop and include namespace
using System.Diagnostics;
foreach (Process p in System.Diagnostics.Process.GetProcessesByName("WINWORD"))
{
p.CloseMainWindow();
p.Kill();
}
throw ex;
using System.Diagnostics;
foreach (Process p in System.Diagnostics.Process.GetProcessesByName("WINWORD"))
{
p.CloseMainWindow();
p.Kill();
}
throw ex;