1

This is the code I have implemented to check whether the process is running or not.

 using System.Diagnostics;

class Program
{
 
    static void Main(string[] args)

    {


        //TODO

    }

    public static bool IsProcessUp(string name)
    {
        
        foreach (Process status in Process.GetProcesses())
        {
            
            if (status.ProcessName.Contains(name))
            {
               
                return true;
             
            }
        }
        
        return false;
    }

}

}

I want to read the names of the processes from appsettings file.

Can someone please let me know how can I do it.

Thankyou.

  • public class AspCoreAppSettingConnectionString { public string DefaultConnection { get; set; } } services.AddOptions(); services.Configure(Configuration.GetSection("ConnectionStrings")); – Hossein Daneshfar Jul 29 '21 at 09:30

0 Answers0