c# windows task monitoring problem

termi

Client
Регистрация
30.10.2012
Сообщения
67
Благодарностей
2
Баллы
8
Hi

I try to create bot that would list all processes in windows so i can check if evrything is runing corecktly. I use c# code bellow.

using System.Diagnostics;
Process[] processlist = Process.GetProcesses();
foreach (Process theprocess in processlist)
{
Console.WriteLine("Process: {0} ID: {1}", theprocess.ProcessName, theprocess.Id);
}

but i get errors

Compile code of Error in action "CS1003" "Syntax error, '(' expected". [Row: 0; Column: 7]
Compile code of Error in action "CS1026" ") expected". [Row: 0; Column: 25]

Also this function should return array how can i save array in to table?
 

EtaLasquera

Client
Регистрация
02.01.2017
Сообщения
524
Благодарностей
112
Баллы
43
You must add using system.diagnostics to own code settings also, add results into a list to save you data is a good idea.
See screenshot.
 

Вложения

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)