[c#] Prevent multiple instances of a given app in .NET?

1 - Create a reference in program.cs ->

using System.Diagnostics;

2 - Put into void Main() as the first line of code ->

 if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length >1)
                return;

That's it.