Why can't I acess a process?

Started by
3 comments, last by Cornstalks 11 years, 2 months ago

As you can see in my code I included System.Diagnostics. The purpose of this program is to get the current process and output it to the console. I am trying to access Process.GetCurrentProcess on line 14 . Also, as you can see, I can only access Process.Program . Why is it that I can't use:

Process.GetCurrentProcess(); and all of the other functions of the Process Class.

166nq81.jpg

Advertisement
Because your program's namespace is also called "Process", you'll need to use "System.Diagnostics.Process" to resolve the diambiguity between System.Diagnostics.Process and Process.

TL;DR: Don't name your program "Process".

Ahhh that seems like a very logical answer. *Voted up* . Yea didn't notice that because the name of the tutorial I am watching is called process. Thank you!

By the way, does this function return a string. for example can I do this:

[source]string myString = Process.GetCurrentProcess();[/source]

By the way, does this function return a string. for example can I do this:

[source]string myString = Process.GetCurrentProcess();[/source]

If you google the function and look up the documenation, you can see it returns a Process, not a string.

[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

This topic is closed to new replies.

Advertisement