C# program for Beginners-Hello World
- To create your first application , Open Visual studio 2008 or Visual C# Express edition.
- In Visual studio select C# from the Menu and select Console Application.
- Next in solution explorer on the right hand corner(if not visible click on view from the menu bar at the top and select solution explorer)rightclick on the program.cs file and rename it to helloworld.cs(it will pop up a message ,just press enter/return key)
- you ll see the name of the class changes to helloworld (highlited in lighter shade of blue color).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class helloworld // name of the class
{
static void Main(string[] args)// main method with void return type
{
Console.WriteLine(" Hello World");// print out the statement on command prompt.
}
}
}
Now Press key F6 to Compile /build the code or use mouse to click on build from the menu bar at the top.
Now Press Key Ctrl+F5 to see the output or choose option Debug from menu bar and click on start without debugging option.
Thats it...you just created your very first application using C#.
No comments:
Post a Comment