How to Prevent the Class from Inheriting in C# ?

You can use the keyword “sealed” in C# to prevent the user from inheriting the class.

Below is a class that is marked as sealed and is not inheritable.

How to Prevent the Class from Inheriting in C# ?

sealed class Employee
{
    public string Name {get;set;}
}