| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| First Time Poster! Join Date: Aug 2008
Posts: 1
![]() | "Hello World" Program example with explanation for beginners "Hello World" Program example with explanation for beginners Here is your steps to start programming in C#. Let first we create a simple program that will show the basics structure of C# programming.If you find C# syntax more interesting the use it for long term. "Hello World" Application with C# Step 1 Start Visual Studio.net. By clicking Start > Programs > Visual Studio.Step2 Create a new project. By clicking File > New > Project and Select "Visual C# Project" and choose the Console application.A project is created for you with the following coding.=====Coding Starts ============== using System; public class Hello { public static void Main (string[] args) { Console.WriteLine("Hello World"); } } =======Coding End ================================= Step3 Compile the application by pressing Ctrl +F5 on the keyboard. Result Will open a new window with text "Hello World"(without quotes).Step4 Let me explain the different lines of the codes so you can understand the basic structure of the applicationusing System; ---->Here "System" is a namespace and if we want to use any classes of the .Net Framework then first of all we have to write the name of the namespace by using the keyword 'using' that means we are using that namespace classes in our application.Example:"Console.WriteLine" is a part of system Namespace. public class Hello ----> This is the name of our class.(as I assume you have some knowledge of OOPS concept.) ????: NamePros.com http://www.namepros.com/code/506437-hello-world-program-example-explanation-beginners.html public static void Main (string[] args) ----> This is the entry point of our program.Here "strin[] args" is the command line parameters. Console.WriteLine("Hello World"); ---> This function will write the "Hello World" on the console. so above is a small program which will make you familiar with C# syntax and know the basics like how to start a new project, compiling program etc. |
| |