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 {
}
Other C# job interview questions
C# for beginners
C# for beginners

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

Test yourself