---
title: "What is a singleton in C#?"  
description: "What is a singleton in C#?"  
author: "Sumit Kesarwani"  
published: 2014-09-22  
updated: 2020-09-21  
canonical: https://www.mindstick.com/interview/2169/what-is-a-singleton-in-c-sharp  
category: "c#"  
tags: [".net", "c#"]  
reading_time: 1 minute  

---

# What is a singleton in C#?

A singleton is a design pattern used when only one instance of an object is created and shared; that is, it only allows one instance of itself to be created. Any attempt to create another instance simply returns a reference to the first one. Singleton classes are created by defining all class constructors as private. In addition, a private static member is created as the same type of the class, along with a public static member that returns an instance of the class

## Answers

### Answer by Anonymous User

nice post

### Answer by Sumit Kesarwani

A singleton is a design pattern used when only one instance of an object is created and shared; that is, it only allows one instance of itself to be created. Any attempt to create another instance simply returns a reference to the first one. Singleton classes are created by defining all class constructors as private. In addition, a private static member is created as the same type of the class, along with a public static member that returns an instance of the class


---

Original Source: https://www.mindstick.com/interview/2169/what-is-a-singleton-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
