Frage im Vorstellungsgespräch bei Commdel

Write Singleton class via different ways

Antworten zu Vorstellungsgespräch

Anonym

1. Okt. 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; } } } }

Anonym

18. Mai 2017

I did it via 4 ways