Commdel interview question

Write Singleton class via different ways

Interview Answers

Anonymous

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; } } } }

Anonymous

18 May 2017

I did it via 4 ways