Singleton using Lazy(T)

Singleton Design Pattern is probably the simplest and most straightforward design pattern. So instead of explaining further, let me get to the code.

image

The whole idea behind the above implementation of Singleton is to make use of the Lazy(T) class provided by Framework 4.0 and provide a lazy initialized version of the pattern, in addition to being thread-safe.

Advertisement

One thought on “Singleton using Lazy(T)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s