Question

How to implement singleton design pattern in C#?
Can anyone help me?

Était-ce utile?

La solution

In singleton pattern, a class can only have one instance and provides access point to it globally.

public sealed class Singleton
{
     private static readonly Singleton _instance = new Singleton();
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top