Subscribe

RSS Feed (xml)

Using the Visual Studio IDE

1. To edit, compile, and run a C# program using Visual Studio 2005, follow these steps.


Create a new, empty C# project by selecting File
New Project. Next, select Visual C#, and then Console Application, as shown here:



Then, change the name to Project1 and press OK.
Note: The precise screens that you see may vary based on which version of Visual Studio 2005 you have installed and your specific configuration.


2. Once the project is created, the Visual Studio IDE will look like this:



3. Notice that a new window called Program.cs was created. This contains an empty template for a C# console program. This file is created automatically by Visual Studio 2005 and contains the skeleton to a C# program. However, this skeleton is more complicated than it needs to be for our purposes, so delete all of the lines in this window. After doing so, the Program.cs window will be blank, and look like this:

4. Next, enter the example program into the Program.cs window, and then save the file using the name Example.cs. (Remember, you can download the programs in this book from www.osborne.com.) When done, your screen will look like this:


5. Compile the program by selecting Build Solution from the Build menu.
6. Run the program by selecting Start Without Debugging from the Debug menu. When you run the program, you will see the window shown here.


As the preceding instructions show, compiling short sample programs using the IDE involves more steps than it does when using the csc command-line compiler. Therefore, for the programs shown in the first part of this book, using the command-line compiler is the recommended approach.

No comments:

Post a Comment

LocalsAdda.com-Variety In Web World

Fun Mail - Fun in the Mail