Commdel interview question

Write Singleton class via different ways

Interview Answers

Anonymous

Oct 1, 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

May 18, 2017

I did it via 4 ways