PrevInstance for VB.NET & C#

Okay this is a fast small snippet as you know some functions that we had in vb6 are missing in vb.net like the PrevInstance so i wrote a small replacement for it and here is it. I Know i should have checked it by the Mutex or Semaphore but like i said this is the fast version ūüėõ

    Function PrevInstance() As Boolean
        Return IIf(UBound(Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName)) > 0, True, False)
    End Function
    public bool PrevInstance()
{
	return (Information.UBound(Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)) > 0 ? true : false);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s