Hello World in C#

I got Class

 
public class Program
{
	...
}

C# is object oriented programming language.  Every project that you build in C# will contain a list of classes that communicate between each other and various resources to perform operations.  Every console applicatioin is required to have entry point which starts execution.  The class for this entry point is commonly called Program and it contains method Main.

For wrapping class { } brackets are used.

 

You can provide many classes in C# program and classes can communicate with each other. Here is an example where Program class instantiates and calls method of another class.

using System; public class Program...


It displayes the output "Hello World" as original program but instead of calling Console.WriteLine("HelloWorld") it instantiates World class and calls Hello();

 

ADVANCED TIP:  Refactoring by moving some of the code from  one function into another is called 'Extract Method'.   You will do this a lot.

 

Page 6 of 10