{"id":48,"date":"2014-05-23T07:34:00","date_gmt":"2014-05-23T06:34:00","guid":{"rendered":"https:\/\/debuggersspace.com\/index.php\/2014\/05\/23\/how-to-implement-singleton-design-pattern-in-c\/"},"modified":"2014-05-23T07:34:00","modified_gmt":"2014-05-23T06:34:00","slug":"how-to-implement-singleton-design-pattern-in-c","status":"publish","type":"post","link":"https:\/\/debuggersspace.com\/index.php\/2014\/05\/23\/how-to-implement-singleton-design-pattern-in-c\/","title":{"rendered":"How to implement singleton design pattern in C#?"},"content":{"rendered":"<div class='booster-block booster-read-block'>\n                <div class=\"twp-read-time\">\n                \t<i class=\"booster-icon twp-clock\"><\/i> <span>Read Time:<\/span>9 Second                <\/div>\n\n            <\/div><div dir=\"ltr\" style=\"text-align: left;\">\n<span style=\"font-family: Arial, Helvetica, sans-serif;\"><span style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\">In singleton pattern, a class can only have one instance and provides access point to it globally.<\/span><br style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\" \/><br style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\" \/><span style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\">Eg:<\/span><br style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\" \/><span style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\">[csharp]<\/span><br style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\" \/><span style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\">Public sealed class Singleton<\/span><br style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\" \/><span style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\">{<\/span><br style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\" \/><span style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\">Private static readonly Singleton _instance = new Singleton();<\/span><br style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\" \/><span style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\">}<\/span><br style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\" \/><span style=\"background-color: white; color: #333333; line-height: 19.200000762939453px;\">[\/csharp]<\/span><\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In singleton pattern, a class can only have one instance and provides access point to it globally.Eg:[csharp]Public sealed class Singleton{Private static readonly Singleton _instance = new Singleton();}[\/csharp]<\/p>\n","protected":false},"author":43,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[24,34],"tags":[],"class_list":["post-48","post","type-post","status-publish","format-standard","hentry","category-c-net","category-ibm"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Himanshu Namdeo","author_link":"https:\/\/debuggersspace.com\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"In singleton pattern, a class can only have one instance and provides access point to it globally.Eg:[csharp]Public sealed class Singleton{Private static readonly Singleton _instance = new Singleton();}[\/csharp]","_links":{"self":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts\/48"}],"collection":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/comments?post=48"}],"version-history":[{"count":0,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts\/48\/revisions"}],"wp:attachment":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/media?parent=48"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/categories?post=48"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/tags?post=48"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}