Question d’entretien chez Commdel

Write Singleton class via different ways

Réponses aux questions d'entretien

Utilisateur anonyme

1 oct. 2017

public sealed class Singleton { Singleton() { } private static readonly object padlock = new object(); private static Singleton instance = null; public static Singleton Instance { get { lock (padlock) { if (instance == null) { instance = new Singleton(); } return instance; } } } }

Utilisateur anonyme

18 mai 2017

I did it via 4 ways