Open
Notepad++
- Click on File / New
- Save as HelloWorld.cs
Enter Code:
// a class is a blueprint/container for data and instructions
class HelloWorld
{
// a method - EVERY program needs a static method called 'Main'
static void Main()
{
// Output text to the screen - use the System class
System.Console.WriteLine("Hello World!");
}
}
Open the Visual Studio Command Window in the SAME FOLDER as the code
- csc HelloWorld.cs - compiles the code
- HelloWorld.exe - executes the code
If there are SYNTAX ERRORS, you must edit the file again & the re-compile
Check for RUNTIME ERRORS
Check for LOGIC ERRORS