Bits & Bytes

Posts Tagged ‘2013’

Creating a C# Console Application in Visual Studio 2013

This post explains how to create a simple console application in C# and make it print out a message. Console applications are the simplest applications. So, this is the perfect place to start if you have no prior knowledge of C#.

  1. Navigate to the Start menu by left-clicking the Windows icon in the lower-left corner of your Desktop screen.
    Desktop
  2. Then left-click the down arrow in the lower-left corner to go the Apps section and find the Visual Studio 2013 icon.
  3. Left-click the Visual Studio 2013 icon to open the Visual Studio 2013 application.
    StartMenu
  4. Left-click FILE in the menubar, mouse over New in the submenu, and left-click Project in the submenu to open the New Project dialog.
    NewProject
  5. Select Installed->Templates->Visual C#->Windows in the left-hand pane.
    Installed_Templates
  6. Then left-click Console Application in the center pane.
    ConsoleAppplication
  7. If you want to accept the default project name and location, left-click the OK button to finish creating the console application. Otherwise, you can first:
    1. Set the name of the project in the field next to “Name:” near the bottom of the dialog.
    2. Select a location by left-clicking the “Browse” button.
  8. Now the project is created. To get the program to do something, add the line
    Console.WriteLine("God is Love!");

    to the code file “Program.cs” so that the final code looks like this:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication {
        class Program {
            static void Main(string[] args) {
                Console.WriteLine("God is Love!");
            }
        }
    }
    
  9. To compile and run the program, left-click DEBUG in the menubar and left-click Start Without Debugging in the submenu.
    StartWithoutDebugging
  10. When the program finishes compiling and runs, a console window should open like this one with the message “God is Love!” inside of it.
    Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.