Syntax to define a class in C Sharp

Syntax to define a class in C#


  1. Modifiers or some special keywords that we can use on class optionally like public, static, internal ,sealed, abstract, partial etc.
  2. Class is a keyword which we use for defining our class very similar to the Struct keyword we use for defining the structure.
  3. Name refers to the name of class which is user define and can have any name.


Syntax to define main method under the class

  1. In java and C# language main method must be declared Static if at all we want to start the execution from here with the help of class Instance.
  2. Main is the name of Method which can not be change and must be in proper case.
  3. While defining the main method if required we can pass parameter to the main method but of type String array only.

1 comment: