This question already has an answer here:
I was reading about Singleton design pattern when i come across this implementation:
public class Singleton
{
private static Singleton Instance { get; private set; }
private Singleton()
{
}
static Singleton()
{
Instance = new Singleton();
}
}
Is this singleton thread safe? What are pros and cons of such implementation?
Aucun commentaire:
Enregistrer un commentaire