Thursday, October 9, 2008

Creating your first C# program

1.Create a new C# console application project by using Visual studio .

2.And type below coding ad compile it

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
// Output text to the screen.
Console.WriteLine(“The first app in Beginning C# Programming!”);
Console.ReadKey();
}
}
}

3.And press the any key to exit from the application.

Brief discussion

1.We used to print the output we use "Console.WriteLine"
2.Here we use "Console.ReadKey();" to detect keyboard input.if we press any key then program will complete it's execution.We used this method here to see out put of the program.otherwise you can't see the output.because it will complete the execution with in second and you can't see the output.to avoid that we use this command.

No comments: