Soumis par
Tidoudoux
le
ven 19/08/2016 - 12:06

Deux trois petite choses en C# pour ne pas avoir à les rechercher la prochaine fois que j'en ai besoin

Comment tester si un processus existe par ID :

private bool ProcessExists(int id) { return Process.GetProcesses().Any(x => x.Id == id); }

Obtenir les arguments passés à l'exécutable :

String[] arguments = Environment.GetCommandLineArgs();

Obtenir l'id du process en cours :

Process currentProcess = Process.GetCurrentProcess();

Pour finir un petit lien vers un article qui explique bien le MVVM :

https://msdn.microsoft.com/en-us/library/gg430857(v=pandp.40).aspx

Étiquettes