Hello World console app with c# visual studio IDE

The following source code should be written in the program.cs window

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HelloWorld
{
class Program
{
          static void Main(string[] args)
{
                 Console.WriteLine(“Enter your name”);
string myName = Console.ReadLine();
                 Console.WriteLine(myName);
                 Console.ReadLine();

}
}

}

11.PNG

Now you can try and run your console application. i should have a .EXE extension

Variable Names should not be spaced

Dots are separators that help to access methods from classes.

Main method is ran first

A method should have brackets to declare activity

A line of code should end with a semi colon ;

Words in blue are the keywords

Variable should be of string data t

 

 

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