In your recent interviews, You have been asked to implement the singleton pattern in c#. In this article I will try to explain what the interviewers wanted to hear ...
The first thing the candidate needs to know is what is the singleton pattern.
If the interviewer was not kind enough to explain what is the singleton pattern - you can find about in Wikipedia
In software engineering, the singleton pattern is a design pattern that restricts the instantiation of a class to one object.
Let's see what the requirements from the singleton class are:
How would you implement those requirements. In the next part we will see the naive solution to this problem