Classes in C#

C# Classes are the primary building blocks of the lauguage.A classes is like a blueprint of object.C# also provides some predefined set of classes and methods.These classes and methods provides many types of functionalities that you many want to impliment in your program or application .

Let's Take an Example

Consider the following code,which defines a class named Codemepro.

    public class Codemepro 
        public static void Main(string[] args)
          System.Console.WriteLine("Hello World");                     

The preceding class declaration includes the method,Main() that will display the message,"Hello World" on your Console Screen.The preceding code includes the following components:

  • The class keyword
  • The class Name
  • The Main() method
  • System.Console.WriteLine() method
  1. In first point The class keyword is used to declare a class.In the code ,the class keyword declare the class, Codemepro
  2. In second point the class is followed by the name of the class .In precceding Code Codemepro is the name of class defined by using the class keyword
  3. The Main() Method is starting point of the program.The method is entry point for an application.This means the execution of code starts form Main() methods.