What is the 'class' keyword used for in C#?

Experience Level: Junior
Tags: C#

Answer

The 'class' keyword is used to define a new class. The 'class' keyword is followed by the class name and curly brackets that contain the body of the class. The class name should contain only alphanumeric characters and it cannot start by a digit. It is a best practice to make each first letter of each word upper case.

Example
public class MyFirstClass {
}

Comments

No Comments Yet.
Be the first to tell us what you think.
C# for beginners
C# for beginners

Are you learning C# ? Try our test we designed to help you progress faster.

Test yourself