p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional C# 4.0 and .NET 4 (http://p2p.wrox.com/forumdisplay.php?f=553)
-   -   Chapter 1 Main() Method (http://p2p.wrox.com/showthread.php?t=90693)

klwint02 August 14th, 2013 03:51 PM

Chapter 1 Main() Method
Hello, I am somewhat of a beginner, but I have not had too much trouble understanding this book until this section:

For Chapter 1 - Section "The Main() Method" - the following sample code is provided at the end:


using System;

namespace Wrox
class ArgsExample
public static int Main(string[] args)
for (int i = 0; i < args.Length; i++)
return 0;
Then it says:

You can compile this as usual using the command line. When you run the compiled executable, you can pass in arguments after the name of the program, as shown in this example:

ArgsExample /a /b /c
However I don't know what "command line" refers to, or where I would input "the name of the program". I have tried using the Windows Command Prompt, as well as the Command Window in Visual Studio, using various commands found on MSDN, and can't make heads or tails of this. Any hints on how to open an executable while passing parameters to its main function as shown above (unless I have misunderstood what the author is saying) would be greatly appreciated.

Before this section, I was just running compiled executables by double-clicking on them in my files. ***Edit: I did it this way because of error CS1619 received in the Visual Studio 2010 Command Prompt because I did not have administrator privileges on the machine I was using.

Thank you for your help.

klwint02 August 15th, 2013 09:20 AM

Found Solution
I know this is basic stuff, but in case anyone else has the same question, I figured this out after a fresh look at it this morning with the help of the following MSDN pages:


You can enter arguments into the "Command line arguments" text box in Visual Studio 2010, which can be found by going to Project => Properties and selecting Debug in the project window.

All times are GMT -4. The time now is 10:56 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.