Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public sealed class Singleton
- {
- private static readonly Singleton instance;
- // Explicit static constructor to tell C# compiler
- // not to mark type as beforefieldinit
- static Singleton()
- {
- instance = new Singleton();
- }
- private Singleton()
- {
- }
- /// <summary>
- /// The public Instance property to use
- /// </summary>
- public static Singleton Instance
- {
- get { return instance; }
- }
- }
Add Comment
Please, Sign In to add comment