檢查執行緒是否有在執行

public static bool IsAlreayRunning() 
    {
        string currentProcessName = Process.GetCurrentProcess().ProcessName;
        Process[] processNamesCoolection = Process.GetProcessesByName(currentProcessName);
        if (processNamesCoolection.Length > 1)
        {
            return true;
        }
        else 
        {
            return false;
        }
    }

Other