MAX WORLD
Saturday, 18 June 2011
C# - Singleton Class using Lazy <T> in Dotnet .40
Code Snippet,
public sealed class Singleton
{
private static readonly Lazy
lazy =
new Lazy
(() => new Singleton());
public static Singleton Instance { get { return lazy.Value; } }
private Singleton()
{
}
}
Reference:-http://csharpindepth.com/Articles/General/Singleton.aspx
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)