Category: C# Advanced

This section contains awesome C# advanced interview questions and answers with example and descriptions for experienced, asked in technical interviews |Only Real.

C# Private Constructor or Sealed Class to stop inheritance?

Interview Question: C# private constructor or sealed class, what to prefer to prevent class extension in inheritance and why? Answer: Best choice is sealed class to prevent a class not to be extended/inherited. This is true that private constructor and sealed class both can prevent extension of a class, means, we cannot derived any class…

Read the full article

What C# feature will you use to keep common behaviors at one place and force clients to implement some others?

Answer: To have common behaviors at one place and force clients to implements others, we should use C# Abstract class and method feature. Abstract class is the class that contains common behaviors/methods and defer implementation of some methods to client’s class in inheritance. Client class will be referred as a derived class. Client classes will…

Read the full article