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.
public class MyFirstClass {
}
Related C# job interview questions
-
What is a breakpoint in C# good for?
C# Junior -
How many classes should be in one .cs file and why?
C# Junior -
What is C#?
C# Junior -
What is a method parameter in C#?
C# Junior -
What is a method return type in C#?
C# Junior