www.c-sharpcorner.com Open in urlscan Pro
40.65.205.118  Public Scan

URL: https://www.c-sharpcorner.com/UploadFile/bd5be5/design-patterns-in-net/
Submission Tags: falconsandbox
Submission: On January 25 via api from US — Scanned from DE

Form analysis 1 forms found in the DOM

POST /UploadFile/bd5be5/design-patterns-in-net/

<form method="post" action="/UploadFile/bd5be5/design-patterns-in-net/" id="aspnetForm">
  <div class="aspNetHidden">
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTY1NDU2MTA1Mg8WAh4TVmFsaWRhdGVSZXF1ZXN0TW9kZQIBZGSv6iaW7DHWsizDJh05dK6poUovig==">
  </div>
  <div class="aspNetHidden">
    <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="8F20C4B5">
    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
      value="/wEdABTDe6iLjFVJv2oW0pUVHbTeQmoBJNsfO7Z5v2qHl4dSq1JY6+4KajMHz5y6ktcgLg19WV5rMKPrT9BgDk43tws4WIbGgOjt7YjcjTWke6h1X2kXEh16NYA+5jYbQj+OEWzqqE/dX2Avs56I7Brvi8OVKz22J7jI39SeIzpBJJKXyq9tw6lz2u6u8nDd4rC4CwzVlbOKf5wL4lZHG8eMEQjROl5RESMbp6/ZjmV5YlnltxUnvI/cSNMZVooSLdwrc7mse+0QHcrrIypCzvVn+eWMRTOvwFfUmE9ZC4xarCSyiBp86SSI0oHkcy7IHhXn42RkIdbx9bYr/Tn9zjxN5MbME6NtFs/REnf5l4xYEDHbo9XJSddAKIVuF8R3ANPrmhf4rmbSzwD7e51/gi+OmGJos+kbtmeWNor3ZTswrP7t1Vv4zu6cPT80w/Rz0URCxJb4Sg5D">
  </div>
  <div id="OldHeader">
    <style type="text/css">
      @media (max-width: 1023px) {
        body.home-page {
          padding-top: 0px !important;
        }

        #OldHeader .responsiveHeader {
          position: inherit;
        }
      }
    </style>
    <div id="ctl00_HeaderHomeNewDesign_Announcement_divAnnouncement"></div>
    <script src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/JQuery/jquery.min-20150912.js"></script>
    <script>
      jQuery(document).ready(function() {
        if (getCookie("topAnnouncementIsHide") != 1) {
          jQuery("#topAnnouncement").hide();
          jQuery("#topAnnouncement").delay(3000).fadeIn('fast', function() {
            jQuery(this).height("48px");
            jQuery("#OldHeader .responsiveHeader").css("top", "48px");
            jQuery("#greenHeaderClose").hover(function() {
              jQuery(this).css({
                "background": "white",
                "color": "black"
              });
            }, function() {
              jQuery(this).css({
                "background": "transparent",
                "color": "white"
              });
            });
            if (window.matchMedia("(max-width:1023px)").matches) {
              jQuery("#OldHeader .responsiveHeader").css({
                "top": "initial"
              });
              jQuery(".HeadermenuStripBlue").css({
                "position": "relative",
                "top": "0px"
              });
              jQuery(".top-header").css("position", "relative");
              jQuery(".rightSide").css("min-width", "320px");
              jQuery(".b-container, #OldHeader .page").css("max-width", "100%");
              jQuery(window).scroll(function() {
                var headPos = jQuery(this).scrollTop();
                if (headPos > 40) {
                  jQuery("#OldHeader .responsiveHeader").css({
                    "position": "fixed",
                    "top": "0px"
                  });
                  jQuery(".HeadermenuStripBlue").css("position", "fixed");
                } else {
                  jQuery('#OldHeader .responsiveHeader, .HeadermenuStripBlue').css({
                    "position": "inherit",
                    "top": "initial"
                  });
                  jQuery(".featuredBox").css("margin-top", "0px");
                }
              });
            }
            if (window.matchMedia("(max-width:640px)").matches) {
              jQuery("#topAnnouncement img").remove();
              jQuery("#topAnnouncement div div:last-child").attr("style", "width: 100%;padding: 0px 6px 0px 10px;box-sizing: border-box !important;position: absolute;top: -3px;min-width:340px;");
              jQuery("#topAnnouncement a:first-child").attr("style", "white-space: nowrap;color:#fff; font-size: 12px;display: inline-block;");
              jQuery("#greenHeaderClose").attr("style",
                "color: #ffffff; border: 2px solid #fff; height: 26px; width: 26px; border-radius: 50%; text-align: center; line-height: initial; position: absolute; transform: scale(0.6); top: 10px; right: 1%;");
            }
          });
        }
      });

      function greenHeaderClose() {
        //document.cookie = "topAnnouncementIsHide = 1";
        document.cookie = "topAnnouncementIsHide=" + "1;expires=Sat, 13 Dec 2021 23:59:59 GMT" + "; path=/";
        jQuery("#topAnnouncement").hide();
        jQuery("#OldHeader .responsiveHeader").css("top", "0px");
        jQuery("#OldHeader .responsiveHeader").css({
          "top": "0"
        });
      }

      function getCookie(cookieName) {
        var name = cookieName + "=";
        var allCookieArray = document.cookie.split(';');
        for (var i = 0; i < allCookieArray.length; i++) {
          var temp = allCookieArray[i].trim();
          if (temp.indexOf(name) == 0) return temp.substring(name.length, temp.length);
        }
        return "";
      }
    </script>
    <div class="responsiveHeader fixed">
      <header class="new-header">
        <div class="top-header">
          <div class="row">
            <div class="logo">
              <a href="https://www.c-sharpcorner.com" id="ctl00_HeaderHomeNewDesign_LogoLink" class="logo" title="C# Corner">

                        <img src="/App_Themes/CSharp/Images/SiteLogo.png" id="ctl00_HeaderHomeNewDesign_imageLogo" class="display_none" alt="C# Corner">
                    </a>
            </div>
            <div class="InFocusNews display_none">
              <div style="position: relative;">
                <div class="rightNew" style="display: inline;">
                  <div class="ticker">
                    <a href="https://www.c-sharpcorner.com/news/c-sharp-corner-achievements-in-2021" id="InFocus">LOOK BACK C# Corner</a>
                  </div>
                </div>
              </div>
            </div>
            <div class="rightSide">
              <div class="login-sec">
                <style>
                  #OldHeader .loginControl .notificationMessageCntr .messageCount {
                    color: #fff;
                    background: #008000;
                    position: absolute;
                    left: 12px;
                    top: 0px;
                    padding: 1px 2px;
                    font-size: 10px;
                    font-weight: bold;
                    display: none;
                    z-index: 1;
                  }

                  #OldHeader {
                    box-sizing: content-box;
                  }
                </style>
                <div id="geoLocationPopup" style="display: none;"></div>
                <div class="page" style="position: relative;">
                  <div class="loginControl">
                    <a href="javascript:void(0)" id="ctl00_HeaderHomeNewDesign_login_HyperLinkWhyJoin" class="join-btn">Why Join</a>
                    <a href="/register" id="ctl00_HeaderHomeNewDesign_login_HyperLinkRegister" title="New User Register Here" class="becomemember display_none">Become a member</a>
                    <a href="/userregistration/logincheck.aspx?returnurl=/uploadfile/bd5be5/design-patterns-in-net/" id="loginBtn" class="login-btn" title="Login">Login</a>
                    <div id="askQuestion" class="notificationMessageCntr display_none_mobile">
                      <a id="PostForum" class="icons askaquestion" title="Ask A Question" href="https://www.c-sharpcorner.com/forums/AddPost.aspx?TSource=AddPost"></a>
                    </div>
                    <div id="commentNotification" class="notificationMessageCntr">
                      <span id="spanCommentsNotifications" style="display: none;" class="messageCount"></span>
                      <span class="arrow">&nbsp;</span>
                    </div>
                    <div id="userCommentBox" class="msg_container" style="display: none;">
                      <div class="NoticationLoading">
                        <label id="LabelNoComments" style="display: none; text-align: center; color: red;"> No unread comment.</label>
                        <a id="imgComments" href="javascript:void(0)" class="loadmore" style="display: none; text-align: center">
                    <img src="/Images/csharp/ajax-loader-small.gif" alt="loading..." width="12" height="9"></a>
                      </div>
                      <ul id="dvComments">
                      </ul>
                      <a class="gotoAllView" href="/notification/">View All Comments</a>
                    </div>
                    <div id="messageNotification" class="notificationMessageCntr">
                      <span id="spanMessages" style="display: none;" class="messageCount"></span>
                      <span class="arrow">&nbsp;</span>
                    </div>
                    <div id="userMsgBox" class="msg_container" style="display: none;">
                      <div class="NoticationLoading">
                        <label id="LabelNoData" style="display: none; text-align: center; color: red;"> No unread message.</label>
                        <a id="imgMessages" href="javascript:void(0)" class="loadmore" style="display: none; text-align: center">
                    <img src="/Images/csharp/ajax-loader-small.gif" width="12" height="9"></a>
                      </div>
                      <ul id="dvMessages">
                      </ul>
                      <a href="/notification/notification.aspx" id="ctl00_HeaderHomeNewDesign_login_LinkButtonAllMessages" class="gotoAllView">View All Messages</a>
                    </div>
                    <div id="generalNotifications" class="notificationMessageCntr">
                      <span id="spanGeneralNotifications" style="display: none;" class="messageCount"></span><span class="arrow">&nbsp;</span>
                    </div>
                    <div id="generalNotificationContainer" class="msg_container general_notifications" style="display: none;">
                      <div class="NoticationLoading">
                        <a id="LabelNoDataNotifications" style="display: none; text-align: center; color: red;">No unread notification.</a>
                        <a id="imgGeneralNotifications" href="javascript:void(0)" class="loadmore" style="display: none; text-align: center">
                    <img src="/Images/csharp/ajax-loader-small.gif" alt="loading..." width="12" height="9"></a>
                      </div>
                      <ul>
                        <div id="dvGeneralNotifications">
                        </div>
                      </ul>
                      <a class="gotoAllView" href="/notification/GeneralNotification.aspx">View All Notifications</a>
                    </div>
                    <div class="notificationMessageCntr display_none_mobile">
                      <span class="arrow">&nbsp;</span>
                    </div>
                    <div class="msg_container admin_msg_container" style="display: none;">
                      <ul id="ctl00_HeaderHomeNewDesign_login_UnapprovedContentStats" class="unapproved_stats">
                      </ul>
                    </div>
                  </div>
                  <a class="menuButton"></a>
                  <a href="https://www.c-sharpcorner.com" id="ctl00_HeaderHomeNewDesign_login_AnchorResponsiveLogo" class="logo_responsive">C# Corner</a>
                </div>
              </div>
              <!--Login Control will come here-->
              <div class="contribute-btn display_none">
                <div class="conbtBtnList">
                  <a href="javascript:void(0);" class="conbtBtn-anchor">Post</a>
                  <ul>
                    <li>
                      <a href="/publish">An Article</a>
                    </li>
                    <li>
                      <a href="/blogs/createblog.aspx">A Blog</a>
                    </li>
                    <li>
                      <a href="/news/createnews.aspx" id="ctl00_HeaderHomeNewDesign_linkPostNews" style="display: none;">A News</a>
                    </li>
                    <li>
                      <a href="/publish/createarticle.aspx?type=videos">A Video</a>
                    </li>
                    <li>
                      <a href="/aboutebookposting.aspx" id="linkPostEbook">An EBook</a>
                    </li>
                    <li>
                      <a href="/interviews/question/postquestion.aspx">An Interview Question</a>
                    </li>
                  </ul>
                </div>
              </div>
              <div class="askquestionbtn display_none">
                <a href="/forums/AddPost.aspx?TSource=AddPost" class="askquestionbtn-anchor">Ask Question</a>
              </div>
            </div>
          </div>
        </div>
        <div id="ctl00_HeaderHomeNewDesign_Menu_HeaderMenu" class="HeadermenuStripBlue">
          <div class="page">
            <div class="responsiveMenu">
              <div class="SearchBox">
                <div id="ctl00_HeaderHomeNewDesign_Menu_Panal1">
                  <input name="ctl00$HeaderHomeNewDesign$Menu$searchTextBox" type="text" id="searchTextBox" class="searchTextBox" placeholder="C# Corner Search" onkeypress="SearchClick(event)">
                  <input type="submit" name="ctl00$HeaderHomeNewDesign$Menu$searchImageButton" value="" onclick="SearchContent(event);" id="searchImageButton" class="button">
                </div>
              </div>
              <ul id="MenuControl1" class="headerMenu">
                <li class="display_none first"><a href="https://www.c-sharpcorner.com" class="csharpHome" title="C# Corner Home">&nbsp;</a></li>
                <li><a href="https://www.c-sharpcorner.com/technologies" title="Technologies">TECHNOLOGIES </a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/forums" title="Ask a Question" target="">ANSWERS</a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/learn/" title="C# Corner Learn" target="">LEARN</a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/news" title="Submit a News" target="">NEWS</a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/blogs" title="Share a Blog" target="">BLOGS</a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/videos" title="Share a Video" target="">VIDEOS</a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/interviews" title="Ask an Interview Question" target="">INTERVIEW PREP</a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/ebooks" title="Share a Book" target="">BOOKS</a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/chapters" title="Join an Event" target="">EVENTS</a></li>
                <li><a class="menu-color-default" href="https://training.c-sharpcorner.com/" title="Training" target="_blank">Training</a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/live/" title="Live" target="">Live</a></li>
                <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/jobs" title="Get Jobs" target="">JOBS</a></li>
                <li class="more-btn"><a href="javascript:void(0);">MORE</a>
                  <ul class="dropdown-content">
                    <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/careeradvice" title="Get Career Advice" target="">CAREER</a></li>
                    <li><a class="menu-color-default" href="https://www.c-sharpcorner.com/members/" title="C# Corner Members" target="">MEMBERS</a></li>
                  </ul>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </header>
    </div>
  </div>
  <div class="b-container page-body">
    <div class="b-row">
      <div class="content">
        <div id="div1" class="content-header">
          <div class="media">
            <div class="media-left media-top hidden-xs">
              <a href="https://www.c-sharpcorner.com/technologies/csharp-programming" id="CategoryLink">
                                    <img src="/UploadFile/MinorCatImages/csharp-programming_210700275.jpg.ashx?width=64&amp;height=64" id="ImgCategory" class="category-image-64" width="64" height="64" title="C#" alt="C#" data-category="144">
                                </a>
            </div>
            <div class="media-body">
              <h1 id="ContentTitle" class="content-heading">Design Patterns In C# .NET</h1>
            </div>
          </div>
          <div style="text-align: center;">
            <div class="publish-info">
              <ul class="list-inline">
                <li><a href="https://www.c-sharpcorner.com/members/kanchan-naik2" id="AuthorProfileLinkOnPhoto">
                                        <img src="https://www.c-sharpcorner.com/uploadfile/authorimage/defaultauthorimage.jpg.ashx?width=98&amp;height=98" id="ImgAuthor" class="user-image-36" data-img-handler=".ashx?width=98&amp;height=98" title="Kanchan Naik">
                                    </a>
                </li>
                <li class="author-name"><a href="https://www.c-sharpcorner.com/members/kanchan-naik2" id="AuthorProfileLinkForName">Kanchan Naik</a></li>
                <li class="content-actions" style="padding: 0px;">
                  <a href="https://www.c-sharpcorner.com/userregistration/logincheck.aspx?returnurl=https://www.c-sharpcorner.com/uploadfile/bd5be5/design-patterns-in-net/history" id="articleHistory" title="Article history"><i class="d-icon icon-history-content" style="background-position: -162px -227px !important;"></i></a>
                </li>
                <li class="publish-time" title="Updated Date" style="color: #666;"> Updated date <span id="PublishDate"><span class="year">Jun 17, 2021</span></span>
                </li>
              </ul>
            </div>
            <div class="content-actions">
              <ul id="TopStatsContainer" class="user-action-list list-inline">
                <li id="FeaturedSpan" class="featured" title="Featured" style="display:none;">
                  <a href="/featured-articles"><i class="d-icon icon-star"></i></a>
                </li>
                <li class="reader-level"><i id="ReaderLevel" class="d-icon icon-28 icon-level-beginner" title="Beginner"></i></li>
                <li class="relative" title="Views"><i class="d-icon icon-view"></i>
                  <span id="ViewCounts" class="user-action-count">1.9m</span>
                </li>
                <li class="relative" title="Comments">
                  <a href="javascript:void(0);" id="CommentIcon">
                                            <i class="d-icon icon-comment2"></i>
                                            <span id="spanComments" class="user-action-count">21</span>
                                        </a>
                </li>
                <li>
                  <a href="javascript:void(0);" id="btnLikeAnchor" class="d-icon icon-28 icon-like like-button"></a>
                  <a href="javascript:void(0);" id="AnchorEmotionPopup" onclick="getContentReactions('5f1da82c-7b51-4583-b71c-6ce7cd887519','article');">
                                            <span id="LabelLikeCount" class="user-action-count">65</span>
                                        </a>
                  <ul id="emotionsContainer" class="emotions-wrapper list-inline">
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(1,&quot;icon-e-like&quot;);" class="d-icon icon-e-like" data-toggle="tooltip" data-title="Like"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(2,&quot;icon-e-love&quot;);" class="d-icon icon-e-love" data-toggle="tooltip" data-title="Love It"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(4,&quot;icon-e-awesome&quot;);" class="d-icon icon-e-awesome" data-toggle="tooltip" data-title="Awesome"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(5,&quot;icon-e-interesting&quot;);" class="d-icon icon-e-interesting" data-toggle="tooltip" data-title="Interesting"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(7,&quot;icon-e-okay&quot;);" class="d-icon icon-e-okay" data-toggle="tooltip" data-title="It's Okay"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(8,&quot;icon-e-poor&quot;);" class="d-icon icon-e-poor" data-toggle="tooltip" data-title="Thumbs Down"></a><span></span></li>
                  </ul>
                </li>
              </ul>
            </div>
          </div>
          <p id="ArticleSummary" style="display: none;" class="article-summary">In this tutorial, learn everything about design patterns in C# and how to Implement design patterns using C# and .NET. Factory design pattern, Abstract Factory design
            pattern, Builder design pattern, Prototype design pattern, Singleton design pattern.</p>
          <div id="ctl00_ad729X90" style="clear: both; padding: 15px;">
            <div id="CsharpCorner_2019_728X90"></div>
          </div>
        </div>
        <div class="cotent-share-icon clearfix">
          <ul data-content-type="Article" style="left: 119px; top: 480px;">
            <li>
              <a class="d-icon icon-facebook-2" title="Share on Facebook" href="https://www.facebook.com/sharer.php?u=https://www.c-sharpcorner.com/UploadFile/bd5be5/design-patterns-in-net/Default.aspx" onclick="popupwindowAtCenter(this.href,'Share on Facebook',600,600);return false;" target="_blank" data-track="">facebook</a>
            </li>
            <li>
              <a class="d-icon icon-twitter-2" title="Share on Twitter" href="https://twitter.com/intent/tweet?&amp;via=CsharpCorner&amp;related=CsharpCorner&amp;text=Design+Patterns+In+C%23+.NET https://www.c-sharpcorner.com/UploadFile/bd5be5/design-patterns-in-net/Default.aspx" target="_blank" data-track="">twitter</a>
            </li>
            <li>
              <a class="d-icon icon-linkedIn-2" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&amp;url=https://www.c-sharpcorner.com/UploadFile/bd5be5/design-patterns-in-net/Default.aspx" onclick="popupwindowAtCenter(this.href,'Share on LinkedIn',600,600);return false;" target="_blank" data-track="">linkedIn</a>
            </li>
            <li>
              <a class="d-icon icon-reddit" title="Share on Reddit" href="//www.reddit.com/submit?title=Design+Patterns+In+C%23+.NET&amp;url=https%3a%2f%2fwww.c-sharpcorner.com%2fUploadFile%2fbd5be5%2fdesign-patterns-in-net%2fdefault.aspx" onclick="popupwindowAtCenter(this.href,'Share on Reddit',600,600);return false;" target="_blank" data-track="">Reddit</a>
            </li>
            <li class="hidden-md-up">
              <a class="d-icon icon-whatsapp" title="Share on Whatsapp" href="whatsapp://send?text=Design Patterns In C# .NET%0A%0Ahttps%3a%2f%2fwww.c-sharpcorner.com%2fUploadFile%2fbd5be5%2fdesign-patterns-in-net%2f" data-action="share/whatsapp/share" target="_blank">WhatsApp</a>
            </li>
            <li id="InnerIconContainer" class="inner-icon-container">
              <ul id="ActionsIconsContainer" style="left: 119px; top: 480px;">
                <li>
                  <a href="https://www.c-sharpcorner.com/userregistration/logincheck.aspx?returnurl=https://www.c-sharpcorner.com/articles/emailtofriend.aspx?articleid=5f1da82c-7b51-4583-b71c-6ce7cd887519" id="ctl00_ImageButtonEmail" cliendidmode="static" class="d-icon icon-email" title="Email this article to friend">Email</a>
                </li>
                <li><a href="javascript:void(0);" id="ImageButtonAddToMyBookmarks" title="Bookmark this article" onclick="return AddToArticleBookmark(this);" class="d-icon icon-32 icon-bookmark-add text-hide">Bookmark</a></li>
                <li id="ListPrintContent" class="hidden-tablet"><a href="javascript:void(GetPrintVersion('Article'))" id="AnchorPrintArticle" title="Print" class="d-icon icon-print">Print</a></li>
                <li id="ctl00_LinkOtherArticles"><a href="https://www.c-sharpcorner.com/members/kanchan-naik2/articles" id="AuthorsOtherArticles" class="d-icon icon-other-article" title="Author's other article">Other Artcile</a></li>
              </ul>
            </li>
            <li id="btnIconExpander" class="hidden-sm-down"><a href="javascript:void(0);" class="d-icon icon-expand" title="Expand">Expand</a></li>
          </ul>
        </div>
        <div class="user-content line-numbers">
          <div class="b-row" style="padding: 0 15px;">
            <div class="content-head-link clearfix">
              <div class="ad-items linkAdContainer">
                <div id="LinkAd_Container" class="LinkAd">
                  <a href="/AdRedirector.aspx?AdId=133&amp;target=https://www.e-iceblue.com/download/free-products.html?aff_id=100" data-adid="133" class="linkAd LinkNormalBlue" target="_blank">Download Free .NET &amp; JAVA Files API</a></div>
              </div>
              <div class="ad-items linkAdContainer">
                <div id="LinkAd_Container" class="LinkAd">
                  <a href="/AdRedirector.aspx?AdId=133&amp;target=https://products.aspose.com/total/net?utm_source=csharpcorner&amp;utm_medium=text-link&amp;utm_campaign=csharpcorner-2020" data-adid="143" class="linkAd LinkNormalBlue" target="_blank">Try Free File Format APIs for Word/Excel/PDF</a>
                </div>
              </div>
            </div>
            <div class="content-head-link clearfix">
              <div id="ctl00_lstDownloadFiles" class="download-items" style="position: relative">
                <div class="icon-box"><i class="d-icon icon-28 icon-download-content" title="Download Files"></i></div>
                <div class="file-box"><a class="text-blue-600  bold" data-download-type="Article" href="javascript:void(0);" onclick="return downloadFile(9352,this)" title="Designpatterns.rar">Designpatterns.rar</a></div>
              </div>
              <div class="ad-items linkAdContainer" id="LinkAdContainerTop">
              </div>
            </div>
          </div>
          <div id="div2" class="PaddingLeft5">
            <p align="justify"></p>
            <h2>Design Patterns In C#</h2>
            <p>Design patterns provide general solutions or a flexible way to solve common design problems. This article provides an introduction of design patterns and how design patterns are implemented in C# and .NET.</p>
            <p>Before starting with design patterns in .NET, let's understand what is the meaning of design patterns and why they are useful in software architecture and programming.</p>
            <h2>What are Design Patterns in Software Development?</h2>
            <p>Design Patterns in the object-oriented world is a reusable solution&nbsp;to common software design problems that occur repeatedly in real-world application development. It is a template or description of how to solve problems that can
              be used in many situations.</p>
            <p>"<em>A pattern is a recurring solution to a problem in a context.</em>"</p>
            <p>"<em>Each pattern describes a problem that occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever
                doing it the same way twice.</em>" - Christopher Alexander, <em>A Pattern Language</em>.</p>
            <p>Patterns are used by developers for their specific designs to solve their problems. Pattern choice and usage among various design patterns depends on individual needs and problems. Design patterns are a very powerful tool for software
              developers. It is important to understand design patterns rather than memorizing their classes, methods, and properties. It is also important to learn how to apply patterns to specific problems to get the desired result. This will be
              the required continuous practice for using and applying design patterns in day to day software development. First, identify the software design problem then see how to address these problems using design patterns and determine the
              best-suited design problem to solve the problem.</p>
            <p>There are 23 design patterns, also known as Gang of Four (GoF) design patterns. The Gang of Four is the authors of the book, "Design Patterns: Elements of Reusable Object-Oriented Software". These 23 patterns are grouped into three
              main categories:</p>
            <p style="text-align: center;"><img alt="Design Patterns In CSharp" class="" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design Patterns In DotNet.jpg"
                src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design Patterns In DotNet.jpg"></p>
            <h2>Creational Design Pattern</h2>
            <ol>
              <li>Factory Method</li>
              <li>Abstract Factory</li>
              <li>Builder</li>
              <li>Prototype</li>
              <li>Singleton</li>
            </ol>
            <h2>Structural Design Patterns</h2>
            <ol>
              <li>Adapter</li>
              <li>Bridge</li>
              <li>Composite</li>
              <li>Decorator</li>
              <li>Façade</li>
              <li>Flyweight</li>
              <li>Proxy</li>
            </ol>
            <h2>Behavioral Design Patterns</h2>
            <ol>
              <li>Chain of Responsibility</li>
              <li>Command</li>
              <li>Interpreter</li>
              <li>Iterator</li>
              <li>Mediator</li>
              <li>Memento</li>
              <li>Observer</li>
              <li>State</li>
              <li>Strategy</li>
              <li>Visitor</li>
              <li>Template Method</li>
            </ol>
            <p>In this article, we are learning and understanding Creational Design Patterns in detail including UML diagram, template source code and a real-world example in C#. Creational Design Patterns provide ways to instantiate a single object
              or group of related objects. These patterns deal with the process of object creation in such a way that they are separated from their implementing system. That provides more flexibility in deciding which object needs to be created or
              instantiated for a given scenario. There are the following five such patterns.</p>
            <h2>Abstract Factory</h2>
            <p>This creates a set of related objects or dependent objects. The "family" of objects created by the factory is determined at run-time depending on the selection of concrete factory classes.</p>
            <p>An abstract factory pattern acts as a super-factory that creates other factories. An abstract factory interface is responsible for creating a set of related objects or dependent objects without specifying their concrete classes.&nbsp;
            </p>
            <p>The UML class diagram below describes an implementation of the abstract factory design pattern.</p>
            <p style="text-align: center;"><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-1.jpg"
                style="height:423px; width:650px"></p>
            <p>The classes, objects, and interfaces used in the above UML diagram are described below.</p>
            <ol>
              <li><em>Client</em> This class uses the Abstract Factory and Abstract Product interfaces to create a family of related objects.</li>
              <li><em>Abstract Factory</em> This is an interface that creates abstract products.</li>
              <li><em>Abstract Product</em> This is an interface that declares a type of product.</li>
              <li><em>Concrete Factory&nbsp;</em> This is a class that implements the abstract factory interface to create concrete products.</li>
              <li><em>Concrete Product&nbsp;</em> This is a class that implements the abstract product interface to create products.</li>
            </ol>
            <p>The following code shows the basic template code of the abstract factory design pattern implemented using C#:</p>
            <p style="text-align: center;"><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-2.jpg"
                style="height:568px; width:493px"></p>
            <p style="text-align: center;"><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-3.jpg"
                style="height:329px; width:476px"></p>
            <p>In the above abstract factory design pattern, the source code template client has two private fields that hold the instances of abstract product classes. These objects will be accessed by inheriting their base class interface. When the
              client is instantiated, a concrete factory object is passed to its constructor and populate private fields of the client with appropriate data or values.</p>
            <p>The Abstractfactory is a base class for concrete factory classes that generate or create a set of related objects. This base class contains the definition of a method for each type of object that will be instantiated. The base class is
              declared as Abstract so that it can be inherited by other concrete factory subclasses.</p>
            <p>The concrete factory classes are inheriting from the Abstractfactory class and override the method of the base class to generate a set of related objects required by the client. There can be a specified number of concrete factory
              classes depending on the software or application requirements.</p>
            <p>Abstractproduct is a base class for the types of objects that the factory class can create. There should be one base type for every distinct type of product required by the client.</p>
            <p>The concrete product classes are inheriting from Abstractproduct class. Each class contains specific functionality. Objects of these classes are generated by abstractfactory classes to populate the client.</p>
            <h2>A real-world example of Abstract factory design pattern using C#</h2>
            <p>As an example, consider a system that does the packaging and delivery of items for a web-based store. The company delivers two types of products. The first is a standard product that is placed in a box and delivered through the post
              with a simple label. The second is a delicate item that requires shock-proof packaging and is delivered via a courier. In this situation, there are two types of objects required, a packaging object and a delivery documentation object.
              We could use two factories to generate these related objects. The one factory will be responsible for creating packaging and other delivery objects for standard parcels. The second will be responsible for creating packaging and delivery
              objects for delicate parcels. <strong>Class Client &nbsp;</strong></p>
            <p style="text-align: center;"><strong><strong><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-4.jpg"
                    style="height:483px; width:512px"></strong></strong></p>
            <p style="text-align: center;"><strong><strong><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-5.jpg"
                    style="height:474px; width:490px"></strong></strong></p>
            <p><strong>AbstractFactory Patterns Form </strong></p>
            <p style="text-align: center;"><strong><strong><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-6.jpg"
                    style="height:521px; width:538px"></strong></strong></p>
            <p><strong>Output</strong></p>
            <p style="text-align: center;"><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-7.jpg"
                style="height:297px; width:518px"></p>
            <p>The example code above creates two client objects, each passing to a different type of factory constructor. Types of generated objects are accessed through the client's properties.&nbsp;&nbsp;</p>
            <p><strong>Note</strong> While studying abstract factory patterns, one question is, what are concrete classes? So I Googled that and the following is the answer to my question. A concrete class is nothing but a normal class that has all
              basic class features, like variables, methods, constructors, and so on. We can create an instance of the class in other classes.</p>
            <p>Here is a&nbsp;detailed article on <a href="https://www.c-sharpcorner.com/article/abstract-factory-design-pattern-in-c-sharp/" target="_blank">Abstract Factory Design Pattern In C#</a></p>
            <h2>Singleton Design Pattern</h2>
            <p>The Singleton design pattern is one of the simplest design patterns. This pattern ensures that the class has only one instance and provides a global point of access to it. The pattern ensures that only one object of a specific class is
              ever created. All further references to objects of the singleton class refer to the same underlying instance.</p>
            <p>There are situations in a project where we want only one instance of the object to be created and shared among the clients. No client can create an instance from outside. It is more appropriate than creating a global variable since
              this may be copied and leads to multiple access points.</p>
            <p>The UML class diagram below describes an implementation of the abstract factory design pattern:</p>
            <p style="text-align: center;"><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-8.jpg"
                style="height:236px; width:404px"></p>
            <p>In the singleton patterns, the UML diagram above the "GetInstace" method should be declared as static. This method returns a single instance held in a private "instance" variable. &nbsp;In the singleton pattern, all the methods and
              instances are defined as static. The static keyword ensures that only one instance of the object is created and you can call methods of the class without creating an object.</p>
            <p>The constructor of a class is marked as private. This prevents any external classes from creating new instances. The class is also sealed to prevent inheritance, which could lead to subclassing that breaks the singleton rules.&nbsp;
            </p>
            <p>The following code shows the basic template code of the singleton design pattern implemented using C#.</p>
            <p><strong>The eager initialization of singleton pattern </strong></p>
            <p style="text-align: center;"><strong><strong><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-9.jpg"
                    style="height:389px; width:469px"></strong></strong></p>
            <p><strong>Lazy initialization of singleton pattern </strong></p>
            <p style="text-align: center;"><strong><strong><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-10.jpg"
                    style="height:414px; width:450px"></strong></strong></p>
            <p><strong>Thread-safe (Double-checked Locking) initialization of singleton pattern </strong></p>
            <p style="text-align: center;"><strong><strong><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-11.jpg"
                    style="height:490px; width:442px"></strong></strong></p>
            <p>The code above shows the "lockThis" object and the use of locking within the "GetInstance" method. Since programs can be multithreaded, it is possible that two threads could request the singleton before the instance variable is
              initialized. By locking the dummy "lockThis" variable, all other threads will be blocked. This means that two threads will not be able to simultaneously create their own copies of the object.</p>
            <h2>A real-world example of Abstract factory design pattern using C#.net</h2>
            <p>I am trying to apply this pattern in my application where I want to maintain an application state for user login information and any other specific information that is required to be instantiated only once and held in only one
              instance.&nbsp;</p>
            <p><strong>Class ApplicationState </strong></p>
            <p style="text-align: center;"><strong><strong><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-12.jpg"
                    style="height:533px; width:446px"></strong></strong></p>
            <p><strong>Singleton pattern form</strong></p>
            <p style="text-align: center;"><strong><strong><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-13.jpg"
                    style="height:527px; width:564px"></strong></strong></p>
            <p><strong>Output </strong></p>
            <p style="text-align: center;"><strong><strong><img alt="Design Patterns In .NET" border="0" class="lazy" data-src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/bd5be5/design-patterns-in-net/Images/Design-Patterns-14.jpg"
                    style="height:262px; width:452px"></strong></strong></p>
            <p>The preceding sample code creates two new variables and assigns the return value of the GetState method to each. They are then compared to check that they both contain the same values and a reference to the same object.</p>
            <p>Here is a detailed article on <a href="https://www.c-sharpcorner.com/article/abstract-factory-design-pattern-in-c-sharp/" target="_blank">Abstract Factory Design Pattern In C#</a></p>
            <p><strong>Interview Questions&nbsp;</strong></p>
            <p>Going for an interview, here are <a href="https://www.c-sharpcorner.com/UploadFile/questpond/design-pattern-interview-questions/" target="_blank">Interview Questions on Design Patterns.</a> &nbsp;</p>
            <h2>Summary&nbsp;</h2>
            <p>I hope this article gives you an introduction to design patterns and various types of design patterns used in .Net.</p>
            <p>In this article, we learned the Abstract Factory and Singleton Design Patterns in detail. The remaining patterns of the Creational Design Pattern Group will be explained in my next article.</p>
            <p><strong>Recommended Articles</strong></p>
            <p>Here is a list of some highly recommended articles related to design patterns.&nbsp;</p>
            <ol>
              <li><a href="https://www.c-sharpcorner.com/article/factory-method-design-pattern-in-c-sharp/" target="_blank">Abstract Factory Design Pattern In C#</a></li>
              <li><a href="https://www.c-sharpcorner.com/article/factory-method-design-pattern-in-c-sharp/" target="_blank">Factory Method Design Pattern In C#</a>&nbsp;</li>
              <li><a href="https://www.c-sharpcorner.com/UploadFile/8911c4/singleton-design-pattern-in-C-Sharp/" target="_blank">Singleton Design Pattern In C#</a></li>
              <li><a href="https://www.c-sharpcorner.com/UploadFile/dacca2/design-pattern-for-beginner-bridge-design-pattern/" target="_blank">Bridge Design Pattern In C#</a></li>
              <li><a href="https://www.c-sharpcorner.com/UploadFile/dacca2/design-pattern-for-beginner-part-3-prototype-design-patter/" target="_blank">Prototype Design Pattern In C#</a></li>
              <li><a href="https://www.c-sharpcorner.com/UploadFile/dacca2/design-pattern-for-beginners-part-4-decorator-design-patt/" target="_blank">Decorator Design Pattern In C#</a></li>
              <li><a href="https://www.c-sharpcorner.com/UploadFile/dacca2/design-pattern-for-beginner-part-5-composite-design-patter/" target="_blank">Composite Design Pattern In C#</a></li>
            </ol>
            <p>Here is a list of more <a href="https://www.c-sharpcorner.com/UploadFile/dacca2/design-pattern-for-beginners-part-6-adaptor-design-patter/" target="_blank">Design Patterns In C#.</a></p>
            <p></p>
          </div>
          <div id="ctl00_divTagsBox" class="tags item-list margin-t15">
            <ul id="ArticleTagKeywords" class="list-inline-float tag-cloud">
              <li><a href="/topics/abstract-design-patterns">Abstract Design patterns</a></li>
              <li><a href="/topics/c-sharp-design-patterns">C# Design patterns</a></li>
              <li><a href="/topics/factory-design-patterns">Factory Design patterns</a></li>
              <li><a href="/topics/singleton-design-patterns">Singleton Design patterns</a></li>
              <li><a href="/topics/structural-design-patterns">Structural Design Patterns</a></li>
            </ul>
          </div>
          <br>
          <br>
          <div class="suggested-article" id="divSuggestedArticle" style="">
            <div class="suggested-heading"> Next Recommended Reading
              <a id="linkRecommendedArticle" class="suggested-title" href="https://www.c-sharpcorner.com/UploadFile/19b1bd/adapter-and-facade-design-pattern-in-C-Sharp/">Adapter and Facade Design Pattern in C#</a>
            </div>
            <div class="suggested-article-description">
              <p id="RecommendedArticleDescription"></p>
            </div>
          </div>
          <div id="OurEbooks">
            <div class="clear"></div>
            <div id="ctl00_TopRadomEbooks" class="related-ebooks">
              <div class="ebooks_title t-center">
                <h2>Our Books</h2>
              </div>
              <div class="divider" style="margin: auto; margin-bottom: 15px;"></div>
              <div class="sliderBox">
                <div id="ctl00_RecommandedEbooks" class="slider slideshow">
                  <ul>
                    <li style="left:40px">
                      <a title="Setting Up SharePoint 2016 Multi-Server Farm In Azure" "="" href="https://www.c-sharpcorner.com/ebooks/setting-up-sharepoint-2016-multi-server-farm-in-azure" target="_blank">
                                <img width="126" height="146" src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/EBooks/08302016055751AM/08312016041248AMsharepoint-multi-server-small.png" alt="">
                                
                            </a>
                    </li>
                    <li style="left:182px">
                      <a title="Diving Into ASP.NET WebAPI" "="" href="https://www.c-sharpcorner.com/ebooks/diving-into-Asp-Net-webapi" target="_blank">
                                <img width="126" height="146" src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/EBooks/05122016072520AM/05122016072547AMDiving into WebAPI_small.jpg" alt="">
                                
                            </a>
                    </li>
                    <li style="left:324px">
                      <a title="Learn Basics of XML" "="" href="https://www.c-sharpcorner.com/ebooks/learn-basics-of-xml" target="_blank">
                                <img width="126" height="146" src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/EBooks/09212013052754AM/05062014012219AM09212013052802AMimg1.png" alt="">
                                
                            </a>
                    </li>
                    <li style="left:466px">
                      <a title="Reporting with Reports Viewer in Visual Studio 2005" "="" href="https://www.c-sharpcorner.com/ebooks/reporting-with-reports-viewer-in-visual-studio_2005" target="_blank">
                                <img width="126" height="146" src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/EBooks/08252011003143AM/05062014013809AM12122011081003AMReportingWithReportsViewerInVisualStudio2005.png" alt="">
                                
                            </a>
                    </li>
                    <li style="left:608px">
                      <a title="SharePoint 2013 .Net Client Side Object Model Cookbook" "="" href="https://www.c-sharpcorner.com/ebooks/sharepoint-2013-dot-net-client-side-object-model-cookbook" target="_blank">
                                <img width="126" height="146" src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/EBooks/08272013010602AM/05062014012430AM08272013011319AMEbook-Cover-Page-Small.png" alt="">
                                
                            </a>
                    </li>
                    <li style="left:750px">
                      <a title="Learning WCF: Practical Implementation" "="" href="https://www.c-sharpcorner.com/ebooks/learning-wcf-practical-implementation" target="_blank">
                                <img width="126" height="146" src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/EBooks/10312014060832AM/10312014061226AMAkshayPatel-small.jpg" alt="">
                                
                            </a>
                    </li>
                    <li style="left:892px">
                      <a title="Build A Full-stack Web Application Using Angular And Firebase" "="" href="https://www.c-sharpcorner.com/ebooks/build-a-full-stack-web-application-using-angular-and-firebase" target="_blank">
                                <img width="126" height="146" src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/EBooks/04282020013139AM/04282020015018AMAnkit Book Cover.jpg" alt="">
                                
                            </a>
                    </li>
                    <li style="left:1034px">
                      <a title="Building Cloud Apps with Windows Azure" "="" href="https://www.c-sharpcorner.com/ebooks/building-cloud-apps-with-windows-azure" target="_blank">
                                <img width="126" height="146" src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/EBooks/08122014041610AM/08122014043440AMCloud Apps with Microsoft Azure.png" alt="">
                                
                            </a>
                    </li>
                  </ul>
                  <div style="clear:both"></div>
                </div>
                <a class="prev" href="javascript:void(0)"><span class="back" id="prev">&lt;</span></a><a class="next" id="next" href="javascript:void(0)"><span class="">&gt;</span></a>
              </div>
            </div>
            <div class="clear"></div>
          </div>
          <div class="clear"></div>
        </div>
        <div class="clear"></div>
        <div class="linkAdContainer bottom" id="LinkAdContainerBottom">
        </div>
        <div class="clear"></div>
        <div id="AboutAuthorBox">
          <div class="author-bio-content">
            <div class="media">
              <div class=" media-left ">
                <a href="https://www.c-sharpcorner.com/members/kanchan-naik2" id="ctl00_AuthorImageAnchor" class="image">
                <img src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/uploadfile/authorimage/defaultauthorimage.jpg.ashx?width=98&amp;height=98" id="ctl00_AuthorImage" class="user-image-98" alt="Kanchan Naik"></a>
              </div>
              <div class="media-body">
                <a href="https://www.c-sharpcorner.com/members/kanchan-naik2" id="AuthorLinkForName" class="author-profile-link">
                <h4 id="AuthorName">Kanchan Naik</h4>
            </a>
                <p id="AuthorBio" class="bio-info"></p>
                <a href="https://www.c-sharpcorner.com/members/kanchan-naik2" class="author-page-link" target="_blank"><i class="d-icon icon-link"></i>https://www.c-sharpcorner.com/members/kanchan-naik2</a>
              </div>
            </div>
            <ul id="AuthorBadgesContainer" class="list-inline author-bio-icons">
              <li title="Overall Rank"><a href="/top-members"><i class="d-icon icon-rank"></i>1979</a></li>
              <li title="Total Views"><a href="https://www.c-sharpcorner.com/members/kanchan-naik2/top-articles"><i class="d-icon icon-book"></i>1.9m</a></li>
              <li title="Starter Member"><a><i class="d-icon icon-medal-  icon-medal-starter"></i></a></li>
              <li title="User is not a C# Corner MVP"><a><i class="d-icon icon-c-MVP icon-disabled"></i></a></li>
            </ul>
          </div>
          <div class="clear">
          </div>
          <div id="FollowPopup" class="follow-popup bottom hide">
            <div class="popup-head">
              <button type="button" title="Close" onclick="return closeFollowPopup();" class="transparent-btn close pull-right close-btn relative"></button>
              <span id="FollowPopupTitle">Don’t miss Kanchan Naik’s next</span>
            </div>
            <div class="media">
              <div class="media-left media-top">
                <a href="https://www.c-sharpcorner.com/members/kanchan-naik2" id="LinkForAuthorPhoto">
                <img src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/uploadfile/authorimage/defaultauthorimage.jpg.ashx?width=98&amp;height=98" id="FollowPopupAuthorImage" title="" class="user-image-48">
            </a>
              </div>
              <div class="media-body">
                <a href="https://www.c-sharpcorner.com/members/kanchan-naik2" id="FollowPopupAuthorName" class="author">Kanchan Naik</a>
                <div class="rpv-wrapper">
                  <i class="d-icon icon-author-r"></i><span id="spanRank" title="Rank">2k</span>
                  <i class="d-icon icon-author-p"></i><span id="spanReputation" title="Reputation">102</span>
                  <i class="d-icon icon-author-v"></i><span id="spanReadCount" title="Total Views">1.9m</span>
                </div>
                <button id="btnFollowAuthor" onclick="followAuthor(true); return false;" class="pill-btn" title="Follow"><span class="follow-sign">+&nbsp;</span>Follow</button>
                <img id="loaderFollowAuthor" src="/Images/csharp/ajax-loader-small.gif" class="hide">
              </div>
            </div>
          </div>
          <input type="hidden" name="ctl00$HiddenFieldAuthorID" id="HiddenFieldAuthorID" value="bd5be5">
          <input type="hidden" name="ctl00$HiddenFieldPageReturnUrl" id="HiddenFieldPageReturnUrl" value="/UploadFile/bd5be5/design-patterns-in-net/">
          <input name="ctl00$hiddenAuthorInfo" type="hidden" id="hiddenAuthorInfo" data-internal="0" data-rank-classname="newSpriteIcons rank" data-twitter-handle="" data-unique-name="kanchan-naik2" data-author-id="bd5be5"
            data-popup-title="Don’t miss Kanchan Naik’s next" data-rank="2k" data-twitter-url="" data-profile-url="https://www.c-sharpcorner.com/members/kanchan-naik2" data-readcount="1.9m" data-user-type="S" data-reputation="102">
          <input name="ctl00$hddTotalFollowers" type="hidden" id="hddTotalFollowers" value="19">
          <input name="ctl00$hddTotalFollowing" type="hidden" id="hddTotalFollowing" value="0">
          <input name="ctl00$hddIsFollowing" type="hidden" id="hddIsFollowing" value="False">
          <input name="ctl00$hddIsLoginAuthorContent" type="hidden" id="hddIsLoginAuthorContent" value="false">
        </div>
        <div class="clear"></div>
        <div id="ctl00_CommentsBox" class="commentsContainer">
          <div class="comment-content-bottom margin-t15 padding-t15">
            <div class="comment-head clearfix article">
              <span id="divViewPreviousComments" class="previous-comments-wrapper"
                style="display: block;"><a href="javascript:void(0);" id="ViewPreviousComments" class="previousComments" style="" onclick="Comments.ViewPreviousComments();return false;">View Previous Comments </a></span>
              <ul class="list-unstyled list-inline user-action-list-footer">
                <li id="BottomEmotionsContainer" class="relative">
                  <a href="javascript:void(0);" id="btnLikeAnchor" class="d-icon icon-28 icon-like like-button"></a>
                  <a href="javascript:void(0);" id="AnchorEmotionPopup" onclick="getContentReactions('5f1da82c-7b51-4583-b71c-6ce7cd887519','article');">
                                            <span id="LabelLikeCount" class="user-action-count">65</span>
                                        </a>
                  <ul id="emotionsContainer" class="emotions-wrapper list-inline">
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(1,&quot;icon-e-like&quot;);" class="d-icon icon-e-like" data-toggle="tooltip" data-title="Like"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(2,&quot;icon-e-love&quot;);" class="d-icon icon-e-love" data-toggle="tooltip" data-title="Love It"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(4,&quot;icon-e-awesome&quot;);" class="d-icon icon-e-awesome" data-toggle="tooltip" data-title="Awesome"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(5,&quot;icon-e-interesting&quot;);" class="d-icon icon-e-interesting" data-toggle="tooltip" data-title="Interesting"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(7,&quot;icon-e-okay&quot;);" class="d-icon icon-e-okay" data-toggle="tooltip" data-title="It's Okay"></a><span></span></li>
                    <li class="relative"><a href="javascript:void(0);" onclick="reactByEmotion(8,&quot;icon-e-poor&quot;);" class="d-icon icon-e-poor" data-toggle="tooltip" data-title="Thumbs Down"></a><span></span></li>
                  </ul>
                </li>
                <li id="commentsBox" class="relative">
                  <a href="javascript:void(0);" id="CommentIcon2" title="Comments">
                <i class="d-icon icon-28 icon-comment2"></i><span id="TotalComments" data-total-count="0" class="user-action-count text-grey-700 title bold">21</span></a>
                </li>
              </ul>
            </div>
            <div id="ctl00_Panel1" defaultbutton="Button1" class="content-bottom-comment">
              <a name="ReadAndPostComment" id="ReadAndPostComment"></a>
              <div class="article" id="commentcontrolslist">
                <div class="comment-body">
                  <div id="cancel_0" style="color:red; font-size:12px; margin-left:67px; margin-bottom:-13px; display:none;" class="hidden-md-down">Press Esc key to cancel</div>
                  <div class="media">
                    <div class="media-left">
                      <img src="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/AuthorImage/DefaultAuthorImage.jpg.ashx?width=56&amp;height=56" alt="" class="user-image-56">
                    </div>
                    <div class="media-body">
                      <div class="mentions-input-box">
                        <div class="mentions">
                          <div></div>
                        </div><textarea id="InputCommentText_0" onkeyup="Comments.RemovePreviousComment('0',this,event,'post');" onkeypress="Comments.PostComment('0',event);" class="form-control mention" spellcheck="true"
                          placeholder="Type your comment here and press Enter Key (Minimum 10 characters)" data-mentions-input="true" style="overflow: hidden;"></textarea>
                        <div
                          style="position: absolute; display: none; overflow-wrap: break-word; white-space: pre-wrap; border-color: rgb(220, 220, 220); border-style: solid; border-width: 1px; font-weight: 400; width: 745px; font-family: &quot;open sans&quot;, sans-serif; line-height: 20px; font-size: 14px; padding: 5px;">
                          &nbsp;</div>
                        <div class="mentions-autocomplete-list"></div>
                      </div>
                      <input type="submit" name="ctl00$ButtonPost" value="" id="ctl00_ButtonPost" style="display: none;">
                      <img id="PostLoader" src="/images/csharp/ajax-loader-small.gif" alt="Loading..." style="clear: both; margin: 10px 5px 0px 0px; float: right; display: none;">
                    </div>
                  </div>
                  <div class="media" id="RootComments">
                    <div class="media" id="comment_211756" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/pranam-bhat"><img class="user-image-56" alt="Pranam Bhat" title="Pranam Bhat" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/a8f7ee20210223030642.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(211756,'a8f7ee','You%20forgot%20to%20mention%20%26quot%3BRepository%20Design%20Patterns%22.%20It%20would%20be%20great%20if%20you%20add%20%22Repository%20Design%20Patterns%22%20here%21','https://www.c-sharpcorner.com/members/pranam-bhat','Pranam Bhat');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">You forgot to mention "Repository Design Patterns". It would be great if you add "Repository Design Patterns" here!</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Nov 10, 2021</span><a href="https://www.c-sharpcorner.com/members/pranam-bhat" alt="Pranam Bhat">Pranam Bhat</a></div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>465</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>4.8k</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>653.5k</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_211756" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(211756)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_211756" class="text-grey-600">0</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(211756)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_211756" class="text-grey-600">0</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(211756)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_211756"></div>
                        </div>
                      </div>
                    </div>
                    <div class="media BackgroundWhite" id="comment_205559" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/shivaji-kakad2"><img class="user-image-56" alt="Shivaji Kakad" title="Shivaji Kakad" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/DefaultAuthorImage.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(205559,'d9cc1c','Thanks%20@Kanchan%20Naik%20for%20sharing%20this%20article.','https://www.c-sharpcorner.com/members/shivaji-kakad2','Shivaji Kakad');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">Thanks @Kanchan Naik for sharing this article.</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Dec 12, 2020</span><a href="https://www.c-sharpcorner.com/members/shivaji-kakad2" alt="Shivaji Kakad">Shivaji Kakad</a>
                          </div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>1993</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>88</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_205559" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(205559)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_205559" class="text-grey-600">0</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(205559)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_205559" class="text-grey-600">0</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(205559)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_205559"></div>
                        </div>
                      </div>
                    </div>
                    <div class="media" id="comment_205043" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/mahesh-pullagura"><img class="user-image-56" alt="Mahesh Pullagura" title="Mahesh Pullagura" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/58182920171216104410.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(205043,'581829','Easy%20to%20understand%20and%20nice%20explanation.','https://www.c-sharpcorner.com/members/mahesh-pullagura','Mahesh Pullagura');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">Easy to understand and nice explanation.</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Nov 07,
                              2020</span><a href="https://www.c-sharpcorner.com/members/mahesh-pullagura" alt="Mahesh Pullagura">Mahesh Pullagura</a></div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>1815</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>266</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_205043" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(205043)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_205043" class="text-grey-600">0</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(205043)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_205043" class="text-grey-600">0</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(205043)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_205043"></div>
                        </div>
                      </div>
                    </div>
                    <div class="media BackgroundWhite" id="comment_192764" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/dushyant-patel"><img class="user-image-56" alt="Dushyant Patel" title="Dushyant Patel" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/3a3ad020191110112131.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(192764,'3a3ad0','Nice%20explanation','https://www.c-sharpcorner.com/members/dushyant-patel','Dushyant Patel');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">Nice explanation</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Nov 10, 2019</span><a href="https://www.c-sharpcorner.com/members/dushyant-patel" alt="Dushyant Patel">Dushyant Patel</a>
                          </div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>1932</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>149</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_192764" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(192764)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_192764" class="text-grey-600">0</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(192764)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_192764" class="text-grey-600">0</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(192764)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_192764"></div>
                        </div>
                      </div>
                    </div>
                    <div class="media" id="comment_190291" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/pankaj-patel25"><img class="user-image-56" alt="Pankaj Patel" title="Pankaj Patel" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/54761920190718064228.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(190291,'547619','Nice%20article','https://www.c-sharpcorner.com/members/pankaj-patel25','Pankaj Patel');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">Nice article</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Sep 13, 2019</span><a href="https://www.c-sharpcorner.com/members/pankaj-patel25" alt="Pankaj Patel">Pankaj Patel</a>
                          </div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>91</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>23.4k</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>1.3m</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_190291" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(190291)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_190291" class="text-grey-600">0</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(190291)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_190291" class="text-grey-600">0</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(190291)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_190291"></div>
                        </div>
                      </div>
                    </div>
                    <div class="media BackgroundWhite" id="comment_189460" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/rajesh-raj14"><img class="user-image-56" alt="rajesh raj" title="rajesh raj" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/e8226420150525060853.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(189460,'e82264','Very%20good%20article%2Creally%20useful%20for%20beginners','https://www.c-sharpcorner.com/members/rajesh-raj14','rajesh raj');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">Very good article,really useful for beginners</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Aug 23, 2019</span><a href="https://www.c-sharpcorner.com/members/rajesh-raj14" alt="rajesh raj">rajesh raj</a></div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>2022</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>59</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_189460" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(189460)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_189460" class="text-grey-600">0</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(189460)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_189460" class="text-grey-600">0</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(189460)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_189460"></div>
                        </div>
                      </div>
                    </div>
                    <div class="media" id="comment_188535" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/mohammad-naderi3"><img class="user-image-56" alt="Mohammad Naderi" title="Mohammad Naderi" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/776c7820190806062234.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(188535,'776c78','Thanks%20Kanchan','https://www.c-sharpcorner.com/members/mohammad-naderi3','Mohammad Naderi');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">Thanks Kanchan</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Aug 06,
                              2019</span><a href="https://www.c-sharpcorner.com/members/mohammad-naderi3" alt="Mohammad Naderi">Mohammad Naderi</a></div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>2018</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>63</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_188535" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(188535)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_188535" class="text-grey-600">1</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(188535)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_188535" class="text-grey-600">0</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(188535)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_188535"></div>
                        </div>
                      </div>
                    </div>
                    <div class="media BackgroundWhite" id="comment_182691" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/eranda-horanagama"><img class="user-image-56" alt="Eranda Horanagama" title="Eranda Horanagama" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/udeshikah20190307114541.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(182691,'udeshikah','Good%20one%2C%20But%20its%20wrong%20about%20double%20check%20lock.%20Idea%20of%20double%20check%20lock%20is%20minimum%20number%20of%20threads%20have%20to%20wait%20and%20that%u2019s%20only%20for%20first%20time.%20As%20name%20implies%20we%20check%20whether%20instance%20is%20null%20twice%2C%20that%27s%20before%20obtain%20the%20lock%20if%20its%20not%20null%20we%20return%20without%20locking.%20Lock%20is%20accrued%20only%20needed%20%28second%20check%20is%20for%20that%29.%20Here%20I%20updated%20your%20sample%20%3A-%20%20%20%20%20%0A%20%20%20%20public%20class%20Singleton%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20private%20static%20Singleton%20instance%20%3D%20null%3B%0A%20%20%20%20%20%20%20%20private%20Singleton%28%29%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20private%20static%20object%20lockThis%20%3D%20new%20object%28%29%3B%0A%0A%20%20%20%20%20%20%20%20public%20static%20Singleton%20GetInstance%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20get%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%09%09if%20%28instance%20%3D%3D%20null%29%0A%09%09%7B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09lock%20%28lockThis%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09if%20%28instance%20%3D%3D%20null%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09instance%20%3D%20new%20Singleton%28%29%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%7D%0A%09%09%7D%0A%09%09return%20instance%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D','https://www.c-sharpcorner.com/members/eranda-horanagama','Eranda Horanagama');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">Good one, But its wrong about double check lock. Idea of double check lock is minimum number of threads have to wait and that’s only for first time. As name implies we check
                            whether instance is null twice, that's before obtain the lock if its not null we return without locking. Lock is accrued only needed (second check is for that). Here I updated your sample :- public class Singleton {
                            private static Singleton instance = null; private Singleton() { } private static object lockThis = new object(); public static Singleton GetInstance { get { if (instance == null) { lock (lockThis) { if (instance == null)
                            instance = new Singleton(); } } return instance; } } }</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Mar 19,
                              2019</span><a href="https://www.c-sharpcorner.com/members/eranda-horanagama" alt="Eranda Horanagama">Eranda Horanagama</a></div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>974</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>1.5k</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>610.4k</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_182691" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(182691)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_182691" class="text-grey-600">2</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(182691)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_182691" class="text-grey-600">2</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(182691)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_182691">
                            <div class="media" id="comment_182981" onmouseover="Comments.ShowEditorOptionsReply(this,event);" onmouseout="Comments.HideEditorOptionsReply(this,event);">
                              <div class="media-left">
                                <a href="https://www.c-sharpcorner.com/members/mahesh-chand"><img class="user-image-56" alt="Mahesh Chand" title="Mahesh Chand" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/mahesh20160308020632.png.ashx?width=56&amp;height=56"></a>
                              </div>
                              <div class="media-body">
                                <div class="commentDescription">
                                  <div class="comment-action-button comment-child">
                                    <a href="javascript:void(0)" class="d-icon icon-flag" onclick="return Comments.ReportComment(182981,'mahesh','Thank%20you%2C%20Eranda.%20Would%20you%20like%20to%20help%20us%20correct%20this%20code%3F%20What%20code%20will%20your%20code%20replace%3F%20Thanks.','https://www.c-sharpcorner.com/members/mahesh-chand','Mahesh Chand');" title="Report this comment"></a>
                                  </div>
                                  <div data-comment="" class="commentDescription">Thank you, Eranda. Would you like to help us correct this code? What code will your code replace? Thanks.</div>
                                  <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Mar 27,
                                      2019</span><a href="https://www.c-sharpcorner.com/members/mahesh-chand" alt="Mahesh Chand">Mahesh Chand</a></div>
                                  <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Admin"><i class="d-icon icon-author-r"></i>Admin</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>343.3k</span> <span
                                        title="Total Views"><i class="d-icon icon-author-v"></i>208.9m</span></span>
                                    <ul class="list-inline comment-reply-wrapper">
                                      <li title="Likes"> <img alt="Loading..." id="ajaxLoader_182981" src="/Images/csharp/ajax-loader-small.gif" class="hide">
                                        <a href="javascript:void(0)" onclick="Comments.LikeComment(182981)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_182981" class="text-grey-600">1</span> </a>
                                      </li>
                                    </ul>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="media" id="comment_205561" onmouseover="Comments.ShowEditorOptionsReply(this,event);" onmouseout="Comments.HideEditorOptionsReply(this,event);">
                              <div class="media-left">
                                <a href="https://www.c-sharpcorner.com/members/shivaji-kakad2"><img class="user-image-56" alt="Shivaji Kakad" title="Shivaji Kakad" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/DefaultAuthorImage.jpg.ashx?width=56&amp;height=56"></a>
                              </div>
                              <div class="media-body">
                                <div class="commentDescription">
                                  <div class="comment-action-button comment-child">
                                    <a href="javascript:void(0)" class="d-icon icon-flag" onclick="return Comments.ReportComment(205561,'d9cc1c','Thanks%20%3Ca%20target%3D%22_blank%22%20class%3D%22LinkNormalBlue%22%20href%3D%22https%3A//www.c-sharpcorner.com/members/eranda-horanagama%22%3EEranda%20Horanagama%3C/a%3E%2C%20you%20are%20absolutely%20right%21','https://www.c-sharpcorner.com/members/shivaji-kakad2','Shivaji Kakad');" title="Report this comment"></a>
                                  </div>
                                  <div data-comment="" class="commentDescription">Thanks <a target="_blank" class="LinkNormalBlue" href="https://www.c-sharpcorner.com/members/eranda-horanagama">Eranda Horanagama</a>, you are absolutely right!</div>
                                  <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Dec 12,
                                      2020</span><a href="https://www.c-sharpcorner.com/members/shivaji-kakad2" alt="Shivaji Kakad">Shivaji Kakad</a></div>
                                  <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>1993</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>88</span> <span
                                        title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                                    <ul class="list-inline comment-reply-wrapper">
                                      <li title="Likes"> <img alt="Loading..." id="ajaxLoader_205561" src="/Images/csharp/ajax-loader-small.gif" class="hide">
                                        <a href="javascript:void(0)" onclick="Comments.LikeComment(205561)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_205561" class="text-grey-600">0</span> </a>
                                      </li>
                                    </ul>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="media" id="comment_179991" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/vaibhav-mayee"><img class="user-image-56" alt="vaibhav  mayee" title="vaibhav  mayee" src="https://www.c-sharpcorner.com/uploadfile/authorimage/defaultauthorimage.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(179991,'vaibhavmayee','Nice%20one%20need%20more%20information%20on%20other%20patterns','https://www.c-sharpcorner.com/members/vaibhav-mayee','vaibhav  mayee');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">Nice one need more information on other patterns</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Dec 28, 2018</span><a href="https://www.c-sharpcorner.com/members/vaibhav-mayee" alt="vaibhav  mayee">vaibhav  mayee</a>
                          </div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>1959</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>122</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_179991" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(179991)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_179991" class="text-grey-600">0</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(179991)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_179991" class="text-grey-600">0</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(179991)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_179991"></div>
                        </div>
                      </div>
                    </div>
                    <div class="media BackgroundWhite" id="comment_178912" onmouseover="Comments.ShowEditorOptions(this,event);" onmouseout="Comments.HideEditorOptions(this,event);">
                      <div class="media-left">
                        <a href="https://www.c-sharpcorner.com/members/snehlata-shaw"><img class="user-image-56" alt="Snehlata Shaw" title="Snehlata Shaw" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/DefaultAuthorImage.jpg.ashx?width=56&amp;height=56"></a>
                      </div>
                      <div class="media-body">
                        <div class="commentDescription">
                          <div class="comment-action-button comment-parent">
                            <a class="d-icon icon-flag" href="javascript:void(0)" onclick="return Comments.ReportComment(178912,'6c819a','Abstract%20factory%20pattern%20can%20also%20be%20implemented%20using%20Interface%2C%20then%20why%20Abstract%20came%20into%20picture%3F%20Any%20specific%20benefit%20of%20having%20Abstract%20class%20instead%20of%20Interface.','https://www.c-sharpcorner.com/members/snehlata-shaw','Snehlata Shaw');" title="Report this comment"></a>
                          </div>
                          <div data-comment="" class="commentDescription">Abstract factory pattern can also be implemented using Interface, then why Abstract came into picture? Any specific benefit of having Abstract class instead of Interface.</div>
                          <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Dec 01, 2018</span><a href="https://www.c-sharpcorner.com/members/snehlata-shaw" alt="Snehlata Shaw">Snehlata Shaw</a>
                          </div>
                          <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>2077</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>4</span> <span
                                title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                            <ul class="list-inline comment-reply-wrapper">
                              <li title="Likes"> <img alt="Loading..." id="ajaxLoader_178912" src="/Images/csharp/ajax-loader-small.gif" style="margin:4px 0px 0px 5px;" class="hide">
                                <a href="javascript:void(0)" onclick="Comments.LikeComment(178912)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_178912" class="text-grey-600">0</span> </a></li>
                              <li title="Replies">
                                <a href="javascript:void(0)" onclick="Comments.ToggleReplies(178912)">                    <i class="v-middle icon-20 d-icon icon-reply-small"></i>                    <span id="Replies_178912" class="text-grey-600">3</span> </a>
                              </li>
                              <li class="text-grey-600">
                                <a class="text-grey-600" href="javascript:void(0)" onclick="Comments.ShowReplyBox(178912)" title="Post Reply">                            <i class="v-middle icon-20 d-icon icon-reply-all-small"></i>Reply</a></li>
                            </ul>
                          </div>
                          <div class="media comment-replies" id="CommentReplies_178912">
                            <div class="media" id="comment_178989" onmouseover="Comments.ShowEditorOptionsReply(this,event);" onmouseout="Comments.HideEditorOptionsReply(this,event);">
                              <div class="media-left">
                                <a href="https://www.c-sharpcorner.com/members/arish-saseendran"><img class="user-image-56" alt="Arish Saseendran" title="Arish Saseendran" src="https://www.c-sharpcorner.com/uploadfile/authorimage/defaultauthorimage.jpg.ashx?width=56&amp;height=56"></a>
                              </div>
                              <div class="media-body">
                                <div class="commentDescription">
                                  <div class="comment-action-button comment-child">
                                    <a href="javascript:void(0)" class="d-icon icon-flag" onclick="return Comments.ReportComment(178989,'7a862a','Since%20it%20is%20an%20Abstract%20class%2C%20we%20will%20be%20able%20to%20take%20advantage%20of%20inheritance.%20Write%20all%20functions%20working%20on%20the%20abstract%20of%20the%20underlying%20products%20in%20the%20Abstract%20factory%20created.','https://www.c-sharpcorner.com/members/arish-saseendran','Arish Saseendran');" title="Report this comment"></a>
                                  </div>
                                  <div data-comment="" class="commentDescription">Since it is an Abstract class, we will be able to take advantage of inheritance. Write all functions working on the abstract of the underlying products in the Abstract
                                    factory created.</div>
                                  <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Dec 03,
                                      2018</span><a href="https://www.c-sharpcorner.com/members/arish-saseendran" alt="Arish Saseendran">Arish Saseendran</a></div>
                                  <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>2072</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>9</span> <span
                                        title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                                    <ul class="list-inline comment-reply-wrapper">
                                      <li title="Likes"> <img alt="Loading..." id="ajaxLoader_178989" src="/Images/csharp/ajax-loader-small.gif" class="hide">
                                        <a href="javascript:void(0)" onclick="Comments.LikeComment(178989)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_178989" class="text-grey-600">0</span> </a>
                                      </li>
                                    </ul>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="media" id="comment_178990" onmouseover="Comments.ShowEditorOptionsReply(this,event);" onmouseout="Comments.HideEditorOptionsReply(this,event);">
                              <div class="media-left">
                                <a href="https://www.c-sharpcorner.com/members/arish-saseendran"><img class="user-image-56" alt="Arish Saseendran" title="Arish Saseendran" src="https://www.c-sharpcorner.com/uploadfile/authorimage/defaultauthorimage.jpg.ashx?width=56&amp;height=56"></a>
                              </div>
                              <div class="media-body">
                                <div class="commentDescription">
                                  <div class="comment-action-button comment-child">
                                    <a href="javascript:void(0)" class="d-icon icon-flag" onclick="return Comments.ReportComment(178990,'7a862a','It%27s%20a%20small%20advantage%20over%20interface%20to%20pack%20the%20functions%20together','https://www.c-sharpcorner.com/members/arish-saseendran','Arish Saseendran');" title="Report this comment"></a>
                                  </div>
                                  <div data-comment="" class="commentDescription">It's a small advantage over interface to pack the functions together</div>
                                  <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Dec 03,
                                      2018</span><a href="https://www.c-sharpcorner.com/members/arish-saseendran" alt="Arish Saseendran">Arish Saseendran</a></div>
                                  <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>2072</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>9</span> <span
                                        title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                                    <ul class="list-inline comment-reply-wrapper">
                                      <li title="Likes"> <img alt="Loading..." id="ajaxLoader_178990" src="/Images/csharp/ajax-loader-small.gif" class="hide">
                                        <a href="javascript:void(0)" onclick="Comments.LikeComment(178990)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_178990" class="text-grey-600">0</span> </a>
                                      </li>
                                    </ul>
                                  </div>
                                </div>
                              </div>
                            </div>
                            <div class="media" id="comment_205782" onmouseover="Comments.ShowEditorOptionsReply(this,event);" onmouseout="Comments.HideEditorOptionsReply(this,event);">
                              <div class="media-left">
                                <a href="https://www.c-sharpcorner.com/members/dinesh-muciliath-jayadevan"><img class="user-image-56" alt="Dinesh Muciliath Jayadevan" title="Dinesh Muciliath Jayadevan" src="https://www.c-sharpcorner.com/UploadFile/AuthorImage/709d4c20201228040226.jpg.ashx?width=56&amp;height=56"></a>
                              </div>
                              <div class="media-body">
                                <div class="commentDescription">
                                  <div class="comment-action-button comment-child">
                                    <a href="javascript:void(0)" class="d-icon icon-flag" onclick="return Comments.ReportComment(205782,'709d4c','In%20Object%20Oriented%20Programming%2C%20abstraction%20can%20be%20implemented%20with%20two%20approaches%20-%20either%20using%20Abstract%20base%20classes%20or%20with%20interfaces.%20For%20all%20practical%20purposes%2C%20interfaces%20are%20%26quot%3Bparent%20classes%22%20just%20like%20Abstract%20base%20classes%20-%20you%20can%20declare%20a%20variable%20of%20the%20interface%20type%2C%20and%20have%20it%20pointed%20to%20one%20of%20the%20derivative%20class%20instances.%20Hence%2C%20both%20can%20be%20used%20to%20implement%20Abstract%20Factory%20pattern.','https://www.c-sharpcorner.com/members/dinesh-muciliath-jayadevan','Dinesh Muciliath Jayadevan');" title="Report this comment"></a>
                                  </div>
                                  <div data-comment="" class="commentDescription">In Object Oriented Programming, abstraction can be implemented with two approaches - either using Abstract base classes or with interfaces. For all practical purposes,
                                    interfaces are "parent classes" just like Abstract base classes - you can declare a variable of the interface type, and have it pointed to one of the derivative class instances. Hence, both can be used to implement
                                    Abstract Factory pattern.</div>
                                  <div class="comment-info clearfix"> <span class="comment-time"> <i class="d-icon icon-clock-small"></i>Dec 28,
                                      2020</span><a href="https://www.c-sharpcorner.com/members/dinesh-muciliath-jayadevan" alt="Dinesh Muciliath Jayadevan">Dinesh Muciliath Jayadevan</a></div>
                                  <div class="comment-info clearfix"><span class="rpv-wrapper"> <span title="Rank"><i class="d-icon icon-author-r"></i>2079</span> <span title="Reputation"><i class="d-icon icon-author-p"></i>2</span> <span
                                        title="Total Views"><i class="d-icon icon-author-v"></i>0</span></span>
                                    <ul class="list-inline comment-reply-wrapper">
                                      <li title="Likes"> <img alt="Loading..." id="ajaxLoader_205782" src="/Images/csharp/ajax-loader-small.gif" class="hide">
                                        <a href="javascript:void(0)" onclick="Comments.LikeComment(205782)">                        <i class="v-middle icon-20 d-icon icon-like-small"></i><span id="Likes_205782" class="text-grey-600">0</span> </a>
                                      </li>
                                    </ul>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div id="ctl00_SocialComments" class="socialComments hidden-sm-down">
          </div>
          <input id="HiddenCommentPageNumber" type="hidden" value="1">
          <input id="HiddenTotalComments" type="hidden" value="15">
          <input type="hidden" name="ctl00$HiddenFieldEmailComment" id="ctl00_HiddenFieldEmailComment">
          <input type="hidden" name="ctl00$HiddenFieldIsChildComment" id="ctl00_HiddenFieldIsChildComment">
          <input type="hidden" name="ctl00$HiddenFieldParentUserId" id="ctl00_HiddenFieldParentUserId">
          <input type="hidden" name="ctl00$hddType" id="hddType" value="article">
          <input type="hidden" name="ctl00$hddContentId" id="hddContentId" value="5f1da82c-7b51-4583-b71c-6ce7cd887519">
          <input type="hidden" name="ctl00$hddCurrentUser" id="hddCurrentUser">
          <input type="hidden" name="ctl00$hddCurrentRole" id="hddCurrentRole">
          <input type="hidden" name="ctl00$hddCurrentUserPhoto" id="hddCurrentUserPhoto" value="https://csharpcorner-mindcrackerinc.netdna-ssl.com/UploadFile/AuthorImage/DefaultAuthorImage.jpg">
          <input type="hidden" name="ctl00$hddAllowPost" id="hddAllowPost" value="true">
          <input type="hidden" name="ctl00$hddContentUserId" id="hddContentUserId" value="bd5be5">
          <input type="hidden" name="ctl00$hddContentUserEmail" id="hddContentUserEmail">
          <input type="hidden" name="ctl00$hddContentTitle" id="hddContentTitle" value="Design Patterns In C# .NET">
          <input type="hidden" name="ctl00$hiddenLoginCheckUrl" id="hiddenLoginCheckUrl" value="https://www.c-sharpcorner.com/userregistration/logincheck.aspx?returnurl=https://www.c-sharpcorner.com/uploadfile/bd5be5/design-patterns-in-net/">
          <input type="hidden" name="ctl00$HiddenRawUrl" id="HiddenRawUrl" value="/UploadFile/bd5be5/design-patterns-in-net/">
          <input type="hidden" name="ctl00$HiddenProcessType" id="HiddenProcessType" value="by-ajax">
        </div>
      </div>
      <div class="right-bar hidden-md-down ">
        <div id="CsharpCorner_2019_300X600"></div>
        <div id="divFeaturedArticles" class="right-bar-panel" style="margin: 20px 0px;">
          <h4 class="heading">FEATURED ARTICLES </h4>
          <ul id="featuredArticlesList" class="stacked-list anchor-list">
            <li><a class="body" href="/article/what-is-the-metaverse/Default.aspx">What Is The Metaverse</a></li>
            <li><a class="body" href="/article/built-in-functions-in-sql-server/Default.aspx">Built-In Functions In SQL Server</a></li>
            <li><a class="body" href="/article/how-to-upgrade-to-windows-11/Default.aspx">How To Upgrade to Windows 11</a></li>
            <li><a class="body" href="/article/exploring-subject-t-in-reactive-extensions-for-net/Default.aspx">Exploring Subject &lt;T&gt; In Reactive Extensions For .Net</a></li>
            <li><a class="body" href="/article/micro-frontends-with-webpack/Default.aspx">Micro Frontends With Webpack</a></li>
          </ul>
          <p class="view-all-link text-right">
            <a href="/featured-articles">View All<i class="c-icon icon-20 icon-view-all"></i></a>
          </p>
        </div>
        <div id="CsharpCorner_2019_336x280"></div>
        <!-- 

 -->
        <div style="clear:both"></div>
        <!-- <div class="sticky-ad">
<div id='CsharpCorner_2019_300X600_Sticky'></div>
</div>

 -->
        <div class="rightbar-items">
          <h4 class="heading">
            <a href="/rss/toparticles.aspx" class="rss-link-right" target="_blank">
            <i class="c-icon icon-rss icon-20"></i>
        </a>TRENDING UP
          </h4>
          <ul id="TrendingUpList" class="numbered-list">
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">01</span></div>
              <div class="media-body media-middle"><a class="body" href="https://www.c-sharpcorner.com/article/how-to-create-a-graphical-loan-repayment-calculator/">How To Create A Graphical Loan Repayment Calculator</a></div>
            </li>
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">02</span></div>
              <div class="media-body media-middle"><a class="body" href="https://www.c-sharpcorner.com/article/jwt-authentication-in-microservices/">JWT Authentication In Microservices</a></div>
            </li>
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">03</span></div>
              <div class="media-body media-middle">
                <a class="body" href="https://www.c-sharpcorner.com/article/create-a-net-5-app-to-perform-crud-operations-on-azure-cosmos-db-sql-api-usin/">Create A .NET 5 App To Perform CRUD Operations On Azure Cosmos DB (SQL API) Using EF Core</a>
              </div>
            </li>
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">04</span></div>
              <div class="media-body media-middle"><a class="body" href="https://www.c-sharpcorner.com/article/what-is-the-metaverse/">What Is The Metaverse</a></div>
            </li>
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">05</span></div>
              <div class="media-body media-middle"><a class="body" href="https://www.c-sharpcorner.com/article/how-to-build-a-calendar-in-python-using-tkinter/">How To Build A Calendar In Python Using Tkinter</a></div>
            </li>
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">06</span></div>
              <div class="media-body media-middle"><a class="body" href="https://www.c-sharpcorner.com/article/microservice-circuit-breaker-pattern/">Microservice Circuit Breaker Pattern</a></div>
            </li>
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">07</span></div>
              <div class="media-body media-middle"><a class="body" href="https://www.c-sharpcorner.com/article/order-of-constructors-calling-with-inheritance-in-c-sharp/">Order Of Constructors Calling With Inheritance In C#</a></div>
            </li>
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">08</span></div>
              <div class="media-body media-middle"><a class="body" href="https://www.c-sharpcorner.com/article/essentials-for-net/">Essentials For .NET</a></div>
            </li>
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">09</span></div>
              <div class="media-body media-middle"><a class="body" href="https://www.c-sharpcorner.com/article/how-to-create-razor-pages-in-asp-net-core-6-0/">How To Create Razor Pages In ASP.NET Core 6.0 </a></div>
            </li>
            <li class="media margin-t8">
              <div class="media-left media-middle"> <span class="numbers">10</span></div>
              <div class="media-body media-middle"><a class="body" href="https://www.c-sharpcorner.com/article/crud-operations-using-blazor-net-6-0-entity-framework-core/">CRUD Operations Using Blazor, .Net 6.0, Entity Framework Core</a></div>
            </li>
          </ul>
          <p class="view-all-link">
            <a href="/top-articles">View All<i class="c-icon icon-view-all"></i></a>
          </p>
        </div>
        <div id="NewArticleAdMiddle"></div>
        <div class="pg-lazy" data-gpt-parent="CsharpCorner_2021_Sidebar"></div>
      </div>
    </div>
  </div>
  <footer>
    <div style="margin: 0 auto;">
    </div>
    <div style="clear: both">
      <div class="bottom-footer">
        <div class="b-container">
          <div>
            <div class="right-items">
              <ul class="footer-social-bar">
                <li><a title="Facebook" target="_blank" href="http://www.facebook.com/pages/C-Corner/194086953935286" class="facebook-icon"><i class="c-icon icon-28 icon-facebook"></i></a></li>
                <li><a title="Twitter" target="_blank" href="http://twitter.com/csharpcorner" class="twitter-icon"><i class="c-icon icon-28 icon-twitter"></i></a></li>
                <li><a title="Youtube" target="_blank" href="http://www.youtube.com/user/CsharpCorner1/" class="youtube-icon"><i class="c-icon icon-28 icon-youtube"></i></a></li>
                <li><a title="iOS App" target="_blank" href="https://itunes.apple.com/us/app/c-corner/id451080586?ls=1&amp;mt=8" class="birch-icon"><i class="c-icon icon-28 icon-birch"></i></a></li>
                <li>
                  <a title="Android App" target="_blank" href="https://play.google.com/store/apps/details?id=com.mcn.csharpcorner&amp;pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1" class="birch-icon"><i class="c-icon icon-28 icon-google-play-store"></i></a>
                </li>
                <li><a title="Windows App" target="_blank" href="https://www.microsoft.com/store/apps/9nblggh4tmwd?ocid=badge" class="birch-icon"><i class="c-icon icon-28 icon-win-store"></i></a></li>
              </ul>
            </div>
            <div class="left-items">
              <ul class="footer-nav">
                <li><a href="https://www.c-sharpcorner.com/about">About Us</a></li>
                <li><a href="https://www.c-sharpcorner.com/contactus.aspx">Contact Us</a></li>
                <li><a href="https://www.c-sharpcorner.com/privacypolicy.aspx">Privacy Policy</a></li>
                <li><a href="https://www.c-sharpcorner.com/termsconditions.aspx">Terms</a></li>
                <li><a href="https://www.c-sharpcorner.com/media/contactus.aspx">Media Kit</a></li>
                <li><a href="https://www.c-sharpcorner.com/sitemap/">Sitemap</a></li>
                <li><a href="https://www.c-sharpcorner.com/report-bugs">Report a Bug</a></li>
                <li><a href="https://www.c-sharpcorner.com/faq">FAQ</a></li>
                <li><a href="https://www.c-sharpcorner.com/partners.aspx">Partners</a></li>
              </ul>
              <ul class="footer-nav" style="margin-top: 10px;">
                <li><a href="https://www.c-sharpcorner.com/csharp-tutorials">C# Tutorials</a></li>
                <li><a href="https://www.c-sharpcorner.com/Common-Interview-Questions">Common Interview Questions</a></li>
                <li><a href="https://www.c-sharpcorner.com/stories">Stories</a></li>
                <li><a href="https://consultants.c-sharpcorner.com/">Consultants</a></li>
                <li><a href="https://www.c-sharpcorner.com/ideas">Ideas</a></li>
                <li><a href="https://www.c-sharpcorner.com/certification">Certifications</a></li>
              </ul>
              <p class="footer-copyright"><small>©2022 C# Corner. All contents are copyright of their authors.</small> </p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <style type="text/css">
      .icon-facebook:before,
      .icon-twitter:before {
        content: '' !important
      }
    </style>
  </footer>
  <input type="hidden" name="ctl00$hddArticleID" id="hddArticleID" value="5f1da82c-7b51-4583-b71c-6ce7cd887519">
  <input type="hidden" name="ctl00$hddRawUrl" id="hddRawUrl" value="/UploadFile/bd5be5/design-patterns-in-net/">
  <input type="hidden" name="ctl00$hiddenFieldReturnUrl" id="hiddenFieldReturnUrl" value="https://www.c-sharpcorner.com/userregistration/logincheck.aspx?returnurl=https://www.c-sharpcorner.com/uploadfile/bd5be5/design-patterns-in-net/">
  <input type="hidden" name="ctl00$hiddenFieldNext" id="ctl00_hiddenFieldNext">
  <input type="hidden" name="ctl00$hiddenFieldPrevious" id="ctl00_hiddenFieldPrevious">
  <input type="hidden" name="ctl00$HiddenFieldCurrentPageUrl" id="ctl00_HiddenFieldCurrentPageUrl" value="https://www.c-sharpcorner.com/UploadFile/bd5be5/design-patterns-in-net/Default.aspx">
  <input type="hidden" name="ctl00$HiddenArticleCategoryID" id="HiddenArticleCategoryID" value="144">
  <input type="hidden" name="ctl00$HiddenRawUrl" id="HiddenRawUrl" value="/UploadFile/bd5be5/design-patterns-in-net/">
  <input type="hidden" name="ctl00$HiddenAuthorId" id="HiddenAuthorId" value="bd5be5">
  <input type="hidden" name="ctl00$HiddenFiledContentTitle" id="HiddenFiledContentTitle" value="Design Patterns In C# .NET">
  <input type="hidden" name="ctl00$HiddenContentType" id="HiddenContentType" value="article">
  <input type="hidden" name="ctl00$HiddenLoginCheckReturnUrl" id="HiddenLoginCheckReturnUrl" value="article">
  <input type="hidden" name="ctl00$HiddenUserRole" id="HiddenUserRole">
  <input type="hidden" name="ctl00$HiddenIsContentApproved" id="HiddenIsContentApproved" value="true">
  <input type="hidden" name="ctl00$HiddenIsAllowPost" id="HiddenIsAllowPost" value="true">
  <input name="ctl00$HiddenContentShortDescription" type="hidden" id="HiddenContentShortDescription"
    value="In this tutorial, learn everything about design patterns in C# and how to Implement design patterns using C# and .NET. Factory design pattern, Abstract Factory  design pattern, Builder design pattern, Prototype design pattern, Singleton design pattern.">
  <input name="ctl00$HiddenContentStats" type="hidden" id="HiddenContentStats" data-views="1.9m" data-is-featured="false" data-level="Beginner">
  <script>
    var arrInFocus = [{
      "Title": "Enroll Now: Full-Stack Blazor Development Course",
      "Url": "https://www.c-sharpcorner.com/news/announcing-fullstack-blazor-development-course",
      "IsActive": true,
      "CreatedDate": "2022-01-10T10:41:27.3688688"
    }, {
      "Title": "LOOK BACK C# Corner In 2021",
      "Url": "https://www.c-sharpcorner.com/news/c-sharp-corner-achievements-in-2021",
      "IsActive": true,
      "CreatedDate": "2021-12-27T14:46:43.6943027"
    }]
  </script>
</form>

Text Content

LOOK BACK C# Corner
Why Join Become a member Login

 
No unread comment.
View All Comments
 
No unread message.
View All Messages
 
No unread notification.
View All Notifications
 

C# Corner
Post
 * An Article
 * A Blog
 * A News
 * A Video
 * An EBook
 * An Interview Question

Ask Question
 *  
 * TECHNOLOGIES
 * ANSWERS
 * LEARN
 * NEWS
 * BLOGS
 * VIDEOS
 * INTERVIEW PREP
 * BOOKS
 * EVENTS
 * Training
 * Live
 * JOBS
 * MORE
   * CAREER
   * MEMBERS


DESIGN PATTERNS IN C# .NET

 * 
 * Kanchan Naik
 * 
 * Updated date Jun 17, 2021

 * 
 * 
 * 1.9m
 * 21
 * 65
   * 
   * 
   * 
   * 
   * 
   * 

In this tutorial, learn everything about design patterns in C# and how to
Implement design patterns using C# and .NET. Factory design pattern, Abstract
Factory design pattern, Builder design pattern, Prototype design pattern,
Singleton design pattern.


 * facebook
 * twitter
 * linkedIn
 * Reddit
 * WhatsApp
 * * Email
   * Bookmark
   * Print
   * Other Artcile
 * Expand

Download Free .NET & JAVA Files API
Try Free File Format APIs for Word/Excel/PDF
Designpatterns.rar



DESIGN PATTERNS IN C#

Design patterns provide general solutions or a flexible way to solve common
design problems. This article provides an introduction of design patterns and
how design patterns are implemented in C# and .NET.

Before starting with design patterns in .NET, let's understand what is the
meaning of design patterns and why they are useful in software architecture and
programming.


WHAT ARE DESIGN PATTERNS IN SOFTWARE DEVELOPMENT?

Design Patterns in the object-oriented world is a reusable solution to common
software design problems that occur repeatedly in real-world application
development. It is a template or description of how to solve problems that can
be used in many situations.

"A pattern is a recurring solution to a problem in a context."

"Each pattern describes a problem that occurs over and over again in our
environment, and then describes the core of the solution to that problem, in
such a way that you can use this solution a million times over, without ever
doing it the same way twice." - Christopher Alexander, A Pattern Language.

Patterns are used by developers for their specific designs to solve their
problems. Pattern choice and usage among various design patterns depends on
individual needs and problems. Design patterns are a very powerful tool for
software developers. It is important to understand design patterns rather than
memorizing their classes, methods, and properties. It is also important to learn
how to apply patterns to specific problems to get the desired result. This will
be the required continuous practice for using and applying design patterns in
day to day software development. First, identify the software design problem
then see how to address these problems using design patterns and determine the
best-suited design problem to solve the problem.

There are 23 design patterns, also known as Gang of Four (GoF) design patterns.
The Gang of Four is the authors of the book, "Design Patterns: Elements of
Reusable Object-Oriented Software". These 23 patterns are grouped into three
main categories:




CREATIONAL DESIGN PATTERN

 1. Factory Method
 2. Abstract Factory
 3. Builder
 4. Prototype
 5. Singleton


STRUCTURAL DESIGN PATTERNS

 1. Adapter
 2. Bridge
 3. Composite
 4. Decorator
 5. Façade
 6. Flyweight
 7. Proxy


BEHAVIORAL DESIGN PATTERNS

 1.  Chain of Responsibility
 2.  Command
 3.  Interpreter
 4.  Iterator
 5.  Mediator
 6.  Memento
 7.  Observer
 8.  State
 9.  Strategy
 10. Visitor
 11. Template Method

In this article, we are learning and understanding Creational Design Patterns in
detail including UML diagram, template source code and a real-world example in
C#. Creational Design Patterns provide ways to instantiate a single object or
group of related objects. These patterns deal with the process of object
creation in such a way that they are separated from their implementing system.
That provides more flexibility in deciding which object needs to be created or
instantiated for a given scenario. There are the following five such patterns.


ABSTRACT FACTORY

This creates a set of related objects or dependent objects. The "family" of
objects created by the factory is determined at run-time depending on the
selection of concrete factory classes.

An abstract factory pattern acts as a super-factory that creates other
factories. An abstract factory interface is responsible for creating a set of
related objects or dependent objects without specifying their concrete classes. 

The UML class diagram below describes an implementation of the abstract factory
design pattern.



The classes, objects, and interfaces used in the above UML diagram are described
below.

 1. Client This class uses the Abstract Factory and Abstract Product interfaces
    to create a family of related objects.
 2. Abstract Factory This is an interface that creates abstract products.
 3. Abstract Product This is an interface that declares a type of product.
 4. Concrete Factory  This is a class that implements the abstract factory
    interface to create concrete products.
 5. Concrete Product  This is a class that implements the abstract product
    interface to create products.

The following code shows the basic template code of the abstract factory design
pattern implemented using C#:





In the above abstract factory design pattern, the source code template client
has two private fields that hold the instances of abstract product classes.
These objects will be accessed by inheriting their base class interface. When
the client is instantiated, a concrete factory object is passed to its
constructor and populate private fields of the client with appropriate data or
values.

The Abstractfactory is a base class for concrete factory classes that generate
or create a set of related objects. This base class contains the definition of a
method for each type of object that will be instantiated. The base class is
declared as Abstract so that it can be inherited by other concrete factory
subclasses.

The concrete factory classes are inheriting from the Abstractfactory class and
override the method of the base class to generate a set of related objects
required by the client. There can be a specified number of concrete factory
classes depending on the software or application requirements.

Abstractproduct is a base class for the types of objects that the factory class
can create. There should be one base type for every distinct type of product
required by the client.

The concrete product classes are inheriting from Abstractproduct class. Each
class contains specific functionality. Objects of these classes are generated by
abstractfactory classes to populate the client.


A REAL-WORLD EXAMPLE OF ABSTRACT FACTORY DESIGN PATTERN USING C#

As an example, consider a system that does the packaging and delivery of items
for a web-based store. The company delivers two types of products. The first is
a standard product that is placed in a box and delivered through the post with a
simple label. The second is a delicate item that requires shock-proof packaging
and is delivered via a courier. In this situation, there are two types of
objects required, a packaging object and a delivery documentation object. We
could use two factories to generate these related objects. The one factory will
be responsible for creating packaging and other delivery objects for standard
parcels. The second will be responsible for creating packaging and delivery
objects for delicate parcels. Class Client  





AbstractFactory Patterns Form



Output



The example code above creates two client objects, each passing to a different
type of factory constructor. Types of generated objects are accessed through the
client's properties.  

Note While studying abstract factory patterns, one question is, what are
concrete classes? So I Googled that and the following is the answer to my
question. A concrete class is nothing but a normal class that has all basic
class features, like variables, methods, constructors, and so on. We can create
an instance of the class in other classes.

Here is a detailed article on Abstract Factory Design Pattern In C#


SINGLETON DESIGN PATTERN

The Singleton design pattern is one of the simplest design patterns. This
pattern ensures that the class has only one instance and provides a global point
of access to it. The pattern ensures that only one object of a specific class is
ever created. All further references to objects of the singleton class refer to
the same underlying instance.

There are situations in a project where we want only one instance of the object
to be created and shared among the clients. No client can create an instance
from outside. It is more appropriate than creating a global variable since this
may be copied and leads to multiple access points.

The UML class diagram below describes an implementation of the abstract factory
design pattern:



In the singleton patterns, the UML diagram above the "GetInstace" method should
be declared as static. This method returns a single instance held in a private
"instance" variable.  In the singleton pattern, all the methods and instances
are defined as static. The static keyword ensures that only one instance of the
object is created and you can call methods of the class without creating an
object.

The constructor of a class is marked as private. This prevents any external
classes from creating new instances. The class is also sealed to prevent
inheritance, which could lead to subclassing that breaks the singleton rules. 

The following code shows the basic template code of the singleton design pattern
implemented using C#.

The eager initialization of singleton pattern



Lazy initialization of singleton pattern



Thread-safe (Double-checked Locking) initialization of singleton pattern



The code above shows the "lockThis" object and the use of locking within the
"GetInstance" method. Since programs can be multithreaded, it is possible that
two threads could request the singleton before the instance variable is
initialized. By locking the dummy "lockThis" variable, all other threads will be
blocked. This means that two threads will not be able to simultaneously create
their own copies of the object.


A REAL-WORLD EXAMPLE OF ABSTRACT FACTORY DESIGN PATTERN USING C#.NET

I am trying to apply this pattern in my application where I want to maintain an
application state for user login information and any other specific information
that is required to be instantiated only once and held in only one instance. 

Class ApplicationState



Singleton pattern form



Output



The preceding sample code creates two new variables and assigns the return value
of the GetState method to each. They are then compared to check that they both
contain the same values and a reference to the same object.

Here is a detailed article on Abstract Factory Design Pattern In C#

Interview Questions 

Going for an interview, here are Interview Questions on Design Patterns.  


SUMMARY 

I hope this article gives you an introduction to design patterns and various
types of design patterns used in .Net.

In this article, we learned the Abstract Factory and Singleton Design Patterns
in detail. The remaining patterns of the Creational Design Pattern Group will be
explained in my next article.

Recommended Articles

Here is a list of some highly recommended articles related to design patterns. 

 1. Abstract Factory Design Pattern In C#
 2. Factory Method Design Pattern In C# 
 3. Singleton Design Pattern In C#
 4. Bridge Design Pattern In C#
 5. Prototype Design Pattern In C#
 6. Decorator Design Pattern In C#
 7. Composite Design Pattern In C#

Here is a list of more Design Patterns In C#.



 * Abstract Design patterns
 * C# Design patterns
 * Factory Design patterns
 * Singleton Design patterns
 * Structural Design Patterns



Next Recommended Reading Adapter and Facade Design Pattern in C#




OUR BOOKS


 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 


<>






KANCHAN NAIK



https://www.c-sharpcorner.com/members/kanchan-naik2
 * 1979
 * 1.9m
 * 
 * 


Don’t miss Kanchan Naik’s next
Kanchan Naik
2k 102 1.9m
+ Follow

View Previous Comments
 * 65
   * 
   * 
   * 
   * 
   * 
   * 
 * 21

Press Esc key to cancel
 

You forgot to mention "Repository Design Patterns". It would be great if you add
"Repository Design Patterns" here!
Nov 10, 2021Pranam Bhat
465 4.8k 653.5k
 * 0
 * 0
 * Reply


Thanks @Kanchan Naik for sharing this article.
Dec 12, 2020Shivaji Kakad
1993 88 0
 * 0
 * 0
 * Reply


Easy to understand and nice explanation.
Nov 07, 2020Mahesh Pullagura
1815 266 0
 * 0
 * 0
 * Reply


Nice explanation
Nov 10, 2019Dushyant Patel
1932 149 0
 * 0
 * 0
 * Reply


Nice article
Sep 13, 2019Pankaj Patel
91 23.4k 1.3m
 * 0
 * 0
 * Reply


Very good article,really useful for beginners
Aug 23, 2019rajesh raj
2022 59 0
 * 0
 * 0
 * Reply


Thanks Kanchan
Aug 06, 2019Mohammad Naderi
2018 63 0
 * 1
 * 0
 * Reply


Good one, But its wrong about double check lock. Idea of double check lock is
minimum number of threads have to wait and that’s only for first time. As name
implies we check whether instance is null twice, that's before obtain the lock
if its not null we return without locking. Lock is accrued only needed (second
check is for that). Here I updated your sample :- public class Singleton {
private static Singleton instance = null; private Singleton() { } private static
object lockThis = new object(); public static Singleton GetInstance { get { if
(instance == null) { lock (lockThis) { if (instance == null) instance = new
Singleton(); } } return instance; } } }
Mar 19, 2019Eranda Horanagama
974 1.5k 610.4k
 * 2
 * 2
 * Reply

Thank you, Eranda. Would you like to help us correct this code? What code will
your code replace? Thanks.
Mar 27, 2019Mahesh Chand
Admin 343.3k 208.9m
 * 1

Thanks Eranda Horanagama, you are absolutely right!
Dec 12, 2020Shivaji Kakad
1993 88 0
 * 0

Nice one need more information on other patterns
Dec 28, 2018vaibhav mayee
1959 122 0
 * 0
 * 0
 * Reply


Abstract factory pattern can also be implemented using Interface, then why
Abstract came into picture? Any specific benefit of having Abstract class
instead of Interface.
Dec 01, 2018Snehlata Shaw
2077 4 0
 * 0
 * 3
 * Reply

Since it is an Abstract class, we will be able to take advantage of inheritance.
Write all functions working on the abstract of the underlying products in the
Abstract factory created.
Dec 03, 2018Arish Saseendran
2072 9 0
 * 0

It's a small advantage over interface to pack the functions together
Dec 03, 2018Arish Saseendran
2072 9 0
 * 0

In Object Oriented Programming, abstraction can be implemented with two
approaches - either using Abstract base classes or with interfaces. For all
practical purposes, interfaces are "parent classes" just like Abstract base
classes - you can declare a variable of the interface type, and have it pointed
to one of the derivative class instances. Hence, both can be used to implement
Abstract Factory pattern.
Dec 28, 2020Dinesh Muciliath Jayadevan
2079 2 0
 * 0



FEATURED ARTICLES

 * What Is The Metaverse
 * Built-In Functions In SQL Server
 * How To Upgrade to Windows 11
 * Exploring Subject <T> In Reactive Extensions For .Net
 * Micro Frontends With Webpack

View All




TRENDING UP

 * 01
   How To Create A Graphical Loan Repayment Calculator
 * 02
   JWT Authentication In Microservices
 * 03
   Create A .NET 5 App To Perform CRUD Operations On Azure Cosmos DB (SQL API)
   Using EF Core
 * 04
   What Is The Metaverse
 * 05
   How To Build A Calendar In Python Using Tkinter
 * 06
   Microservice Circuit Breaker Pattern
 * 07
   Order Of Constructors Calling With Inheritance In C#
 * 08
   Essentials For .NET
 * 09
   How To Create Razor Pages In ASP.NET Core 6.0
 * 10
   CRUD Operations Using Blazor, .Net 6.0, Entity Framework Core

View All



 * 
 * 
 * 
 * 
 * 
 * 

 * About Us
 * Contact Us
 * Privacy Policy
 * Terms
 * Media Kit
 * Sitemap
 * Report a Bug
 * FAQ
 * Partners

 * C# Tutorials
 * Common Interview Questions
 * Stories
 * Consultants
 * Ideas
 * Certifications

©2022 C# Corner. All contents are copyright of their authors.


EN ▼
BG
DA
DE
ES
FI
FR
IT
NL
NO
PL
PT
SR
SV
RO


Trust and transparency is important to us.

It takes a lot of work to build, maintain, and improve a site like this and all
the wonderful content you're about to enjoy. We and third parties use tech like
cookies to make this happen.

By continuing, you consent to the use of these technologies, and affirm you're
at least 16 years old or have consent from a parent or guardian. Learn more and
customize.



Save & Continue
Continue with Cookies