<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1034148257613744113</id><updated>2020-05-30T18:25:42.567+05:30</updated><category term="MVC"/><category term="c#"/><category term="c# tutorial"/><category term="encapsulation in java"/><category term="object oriented programming"/><category term="oop in c"/><category term="sql server"/><category term="sql server management studio"/><category term="pl sql"/><category term="programming"/><category term="ql queries"/><title type='text'>Solutions and Techniques in C#, MVC, SQL Server</title><subtitle type='html'>Hello Friends,&#xa;Welcome to my blog, here you can find solutions for beginner and advance in Object Oriented Programming with C#, MVC. Best solutions for C#, SQL Server using ASP.NET by implementing OOP.&#xa;c#, c# tutorial, encapsulation in java, MVC, object oriented programming, oop in c, sql server, sql server management studio</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://sanjaydgangurde.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='https://sanjaydgangurde.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sanjay Gangurde</name><uri>http://www.blogger.com/profile/11280682843238530560</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//2.bp.blogspot.com/-_P2Drot4FVI/Xr6FDF6xNyI/AAAAAAAAA1g/y9r1SWcsFJQG7mzFfCi4y6tyXbz_Sm23QCK4BGAYYCw/s220/B612_20171203_073323.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1034148257613744113.post-6334466404005094943</id><published>2020-05-22T18:48:00.001+05:30</published><updated>2020-05-30T18:24:30.629+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="encapsulation in java"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="object oriented programming"/><category scheme="http://www.blogger.com/atom/ns#" term="oop in c"/><category scheme="http://www.blogger.com/atom/ns#" term="pl sql"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="ql queries"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server management studio"/><title type='text'>CSharp Webconfig Interview Questions </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;1). What is web.config file in asp.net?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;Web.config is the configurationsettings of an ASP.NET web application. The file is an xml document that defines configuration information regarding the web application.This file stores the information about how the web application will act.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;2). Does web.config file case-sensitive?&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Yes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;3). Web.config file is stored in which form?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;Web.config files are stored in XML format.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;4). Can one directory contain multiple web.config files?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;No. One directory can contain only one file.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;5). Can you tell the location of the root web.config file from which all web.config file inherit ?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;All the Web.config files inherit the root Web.config file available at the following location:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;Systemroot\Microsoft.NET\Framework\VersionNumber\CONFIG\Web.config&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;6). What is the root tag of web.config file?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;b style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&amp;lt;configuration&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;tag is the root element of the Web.config file under which it has all the remaining sub elements.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;7). What is the use of customErrors tag in web.config file ?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;CustomErrors tag provides information about custom error messages for an &amp;nbsp;application. The customErrors element can be defined at any level in the application file hierarchy.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;lt;customErrors defaultRedirect =&quot;ErrorPage.aspx&quot; mode =&quot;Off&quot;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;lt;error statusCode =&quot;401&quot; redirect =&quot;UnauthorizedPage.aspx&quot;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;lt;/customErrors&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;The customErrors section consists of defaultRedirect and mode attributes which specify the default redirect page and the on/off mode respectively.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Error status code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; color: #333333; line-height: normal; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;400 Bad Request&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; color: #333333; line-height: normal; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;401 Unauthorized&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; color: #333333; line-height: normal; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;404 Not Found&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; color: #333333; line-height: normal; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;408 Request Timeout&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;8). Can you describe the funcnalitity of &amp;lt;httpHandlers&amp;gt; tab in web.config?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;HttpHandler is a code that executes when an http request for a specific resource is made to the server. For example, request an .aspx page the ASP.NET page handler is executed, similarly if an .asmx file is requested, the ASP.NET service handler is executed. An HTTP Handler is a component that handles the ASP.NET requests at a lower level than ASP.NET is capable of handling.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;9). What is authentication tag/section in web.config?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;ASP.NET implements additional authentication schemes using authentication providers, which are separate from and apply only after the IIS authentication schemes. ASP.NET supports the following authentication providers:&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; color: #333333; line-height: normal; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Windows (default)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; color: #333333; line-height: normal; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Forms&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; color: #333333; line-height: normal; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Passport&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; color: #333333; line-height: normal; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;None&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;To enable an authentication provider for an ASP.NET application, use the authentication element in either machine.config or Web.config as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;lt;system.web&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;lt;!-- mode=[Windows|Forms|Passport|None] --&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;lt;authentication mode=&quot;Windows&quot; /&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;lt;/system.web&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;10). For which purpose you use &amp;lt;appSettings&amp;gt; tag?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;AppSettings tag helps us to store the application settings information like connection strings, file paths, URLs, port numbers, custom key value pairs, etc.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;lt;appSettings&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;add key=&quot;ConnectionString&quot; value=&quot;Data Srouce=.....&quot;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;lt;/appSettings&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;11). What is the use of connectionStrings tag?&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #333333; font-family: verdana, sans-serif;&quot;&gt;&amp;lt;ConnectionStrings&amp;gt; is the most common section of web.config file which allows you to store multiple connection strings that are used in the application.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;lt;connectionStrings&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;lt;add name =&quot;ConnectionString&quot; connectionString =&quot;Initial Catalog = dotnet;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Data Source =localhost; Integrated Security = true&quot;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #c7254e;&quot;&gt;&amp;lt;/connectionStrings&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0.0001pt; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style=&quot;font-family:verdana;&quot;&gt;You can find more blogs on our website: &lt;a style=&quot;text-decoration:none&quot; target=&quot;_blank&quot; href=&quot;https://www.trigyatechnologies.com/&quot;&gt;&lt;span style=&quot;color:#931B3D;&quot;&gt;Trigya Technologies&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://sanjaydgangurde.blogspot.com/feeds/6334466404005094943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/csharp-webconfig-interview-questions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/6334466404005094943'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/6334466404005094943'/><link rel='alternate' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/csharp-webconfig-interview-questions.html' title='CSharp Webconfig Interview Questions '/><author><name>Sanjay Gangurde</name><uri>http://www.blogger.com/profile/11280682843238530560</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//2.bp.blogspot.com/-_P2Drot4FVI/Xr6FDF6xNyI/AAAAAAAAA1g/y9r1SWcsFJQG7mzFfCi4y6tyXbz_Sm23QCK4BGAYYCw/s220/B612_20171203_073323.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1034148257613744113.post-6530337982091761434</id><published>2020-05-22T18:31:00.003+05:30</published><updated>2020-05-30T18:24:38.772+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="encapsulation in java"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="object oriented programming"/><category scheme="http://www.blogger.com/atom/ns#" term="oop in c"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server management studio"/><title type='text'>MVC Life Cycle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;border: 1pt none; color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt; padding: 0in;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-o2lVbIOWmIM/XsfM1WC5IzI/AAAAAAAAA6w/Qi0coSymkPw_GvFtl4S8grfW0SU0x-bSACNcBGAsYHQ/s1600/MVC-Life-Cycle.png&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;MVC Life Cycle&quot; border=&quot;0&quot; data-original-height=&quot;974&quot; data-original-width=&quot;1269&quot; height=&quot;305&quot; src=&quot;https://1.bp.blogspot.com/-o2lVbIOWmIM/XsfM1WC5IzI/AAAAAAAAA6w/Qi0coSymkPw_GvFtl4S8grfW0SU0x-bSACNcBGAsYHQ/s400/MVC-Life-Cycle.png&quot; title=&quot;MVC Life Cycle&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: small;&quot;&gt;MVC Life Cycle&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;border: 1pt none; color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt; padding: 0in;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: justify;&quot;&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;border: 1pt none; color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt; padding: 0in;&quot;&gt;Creating the request object: -&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt;&quot;&gt;The request object creation has four major steps. Below is the detail explanation of the same.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;border: 1pt none; color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt; padding: 0in;&quot;&gt;Step 1 Fill route: -&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt;&quot;&gt;&amp;nbsp;MVC requests are mapped to route tables which in turn specify which controller and action to be invoked. So if the request is the first request the first thing is to fill the route table with routes collection. This filling of route table happens in the global.asax file.&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;border: 1pt none; color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt; padding: 0in;&quot;&gt;Step 2 Fetch route: -&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt;&quot;&gt;&amp;nbsp;Depending on the URL sent “UrlRoutingModule” searches the route table to create “RouteData” object which has the details of which controller and action to invoke.&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;border: 1pt none; color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt; padding: 0in;&quot;&gt;Step 3 Request context created: -&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt;&quot;&gt;&amp;nbsp;The “RouteData” object is used to create the “RequestContext” object.&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;border: 1pt none; color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt; padding: 0in;&quot;&gt;Step 4 Controller instance created: -&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt;&quot;&gt;&amp;nbsp;This request object is sent to “MvcHandler” instance to create the controller class instance. Once the controller class object is created it calls the “Execute” method of the controller class.&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;border: 1pt none; color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt; padding: 0in;&quot;&gt;Creating Response object: -&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;color: #111111; font-family: &amp;quot;segoe ui&amp;quot;, sans-serif; font-size: 10.5pt;&quot;&gt;&amp;nbsp;This phase has two steps executing the action and finally sending the response as a result to the view.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style=&quot;font-family:verdana;&quot;&gt;You can find more blogs on our website: &lt;a style=&quot;text-decoration:none&quot; target=&quot;_blank&quot; href=&quot;https://www.trigyatechnologies.com/&quot;&gt;&lt;span style=&quot;color:#931B3D;&quot;&gt;Trigya Technologies&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://sanjaydgangurde.blogspot.com/feeds/6530337982091761434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/mvc-life-cycle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/6530337982091761434'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/6530337982091761434'/><link rel='alternate' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/mvc-life-cycle.html' title='MVC Life Cycle'/><author><name>Sanjay Gangurde</name><uri>http://www.blogger.com/profile/11280682843238530560</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//2.bp.blogspot.com/-_P2Drot4FVI/Xr6FDF6xNyI/AAAAAAAAA1g/y9r1SWcsFJQG7mzFfCi4y6tyXbz_Sm23QCK4BGAYYCw/s220/B612_20171203_073323.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-o2lVbIOWmIM/XsfM1WC5IzI/AAAAAAAAA6w/Qi0coSymkPw_GvFtl4S8grfW0SU0x-bSACNcBGAsYHQ/s72-c/MVC-Life-Cycle.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1034148257613744113.post-732518253210627782</id><published>2020-05-18T11:08:00.002+05:30</published><updated>2020-05-30T18:24:52.212+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="encapsulation in java"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="object oriented programming"/><category scheme="http://www.blogger.com/atom/ns#" term="oop in c"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server management studio"/><title type='text'>CSharp MVC Interview Questions and Answers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt; &lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-27y15ZMPGOA/XsIjhnGwVSI/AAAAAAAAA3Y/GKCfBj4WuX0FN-DtwcOLS7pRgBwgX-AdQCNcBGAsYHQ/s1600/CInterview-Questions-and-Answers.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;CSharp MVC Interview Questions and Answers&quot; border=&quot;0&quot; data-original-height=&quot;500&quot; data-original-width=&quot;900&quot; height=&quot;220&quot; src=&quot;https://1.bp.blogspot.com/-27y15ZMPGOA/XsIjhnGwVSI/AAAAAAAAA3Y/GKCfBj4WuX0FN-DtwcOLS7pRgBwgX-AdQCNcBGAsYHQ/s400/CInterview-Questions-and-Answers.jpg&quot; title=&quot;CSharp MVC Interview Questions and Answers&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;To call only derived class method&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;ConsoleApplication1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;A()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;A is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;print()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;A&#39;s Print is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;B()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;B is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;print()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;B&#39;s Print is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;Main(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;p =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;p.print();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;A is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;B is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;B’s Print is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Note: The access specifier for constructor A is applied because we need to achieve through inheritance and it won’t be accessible due to protection level if it is applied.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: calibri, sans-serif; font-size: 11pt; line-height: 16.8667px;&quot;&gt;&lt;br clear=&quot;all&quot; style=&quot;break-before: page;&quot; /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;To call base and derived class method&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;ConsoleApplication1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;A()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;A is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;print()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;A&#39;s Print is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;B()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;B is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;print()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.print();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;B&#39;s Print is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;Main(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;p =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;p.print();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;A is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;B is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;A’s Print is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;B’s Print is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Note:&amp;nbsp;&lt;/b&gt;To access the method of base class whose name is same. This can be achieve using base keyword.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;If object of derived class is created and pointing reference towards to base then it will result to compile time error,&lt;br /&gt;Cannot access protected member ‘A.print()’ via a qualifier of type ‘A’; the qualifier must be of type ‘B’.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;If the base is abstract class then to the output will be same.&lt;b&gt;&lt;br clear=&quot;all&quot; style=&quot;break-before: page;&quot; /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Static Constructor Example with Sequence:&lt;/span&gt;&lt;span style=&quot;font-size: 14pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;ConsoleApplication1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;A()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;A is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;A()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Static A&#39;s is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;B()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;B is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;B()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Static B&#39;s is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;Main(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;p =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Static B’s is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Static A’s is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;A is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;B is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Note: Always derived class static constructor is called then base class static constructor will be called and so on.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;If object of derived class is created and pointing reference towards to base class then to output will be same.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 18.4px;&quot;&gt;&lt;br clear=&quot;all&quot; style=&quot;break-before: page;&quot; /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Abstract Class&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; text-align: justify; text-indent: -0.25in;&quot;&gt;Abstract class method can be abstract and non-abstract method.&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; text-align: justify; text-indent: -0.25in;&quot;&gt;If we declaring any method in abstract class then the method should be prefixed will abstract keyword, the access specifier should be public or protected.&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; text-align: justify; text-indent: -0.25in;&quot;&gt;To implement the abstract method, we should use override keyword with the same access specifier.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;ConsoleApplication1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;abstract&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;A()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Abstract class constructor is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;A()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Abstract class static constructor is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;abstract&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;print();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;display()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Abstract class display method is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;B()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Derived class constructor is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;print()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Abstract method is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;display()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.display();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Derived class display method is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;Main(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;p =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;p.print();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;p.display();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Abstract class static constructor is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Abstract class constructor is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Derived class constructor is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Abstract method is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Abstract class display method is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Derived class display method is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Note: Creating object of Derived class and pointing reference to Base class will result to error.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 18.4px;&quot;&gt;&lt;br clear=&quot;all&quot; style=&quot;break-before: page;&quot; /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Interface:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;1.&lt;span style=&quot;font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;An interface is a contract between itself and any class that implements it. This contract states that any class that implements the interface will implement the interface&#39;s properties, methods and/or events.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;2.&lt;span style=&quot;font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;An interface contains no implementation, only the signatures of the functionality the interface provides. An interface can contain signatures of methods, properties, indexers, and events.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;3.&lt;span style=&quot;font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Using interface-based design concepts provides loose coupling, component-based programming, easier maintainability, makes your code base more scalable and makes code reuse much more accessible because the implementation is separated from the interface.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;4.&lt;span style=&quot;font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Interfaces add a&amp;nbsp;&lt;i&gt;plug and play&lt;/i&gt;&amp;nbsp;like architecture into your applications. Interfaces help define a contract (agreement or blueprint, however you chose to define it), between your application and other objects. This indicates what sort of methods, properties, and events are exposed by an object.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;ConsoleApplication1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;interface&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;I1&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;Paint();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;interface&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;I2&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;Paint();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;I1&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;I2&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;I1&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.Paint()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Paint method of I1 is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;Main(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;[] args)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;a =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;I1&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;i1 = a;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;I2&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;i2 = a;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;i1.Paint();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;i2.Paint();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: consolas; font-size: 9.5pt;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;I2&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.Paint()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2b91af; font-family: consolas; font-size: 9.5pt;&quot;&gt;Console&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: consolas; font-size: 9.5pt;&quot;&gt;&quot;Paint method of I2 is called&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;color: black; font-family: consolas; font-size: 9.5pt;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Output:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Paint method of I1 is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Paint method of I2 is called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 11pt; line-height: 16.8667px;&quot;&gt;&lt;br clear=&quot;all&quot; style=&quot;break-before: page;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Action Filters:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #171717;&quot;&gt;&lt;span&gt;1.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;An action filter is an attribute that you can apply to a controller action -- or an entire controller -- that modifies the way in which the action is executed.&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #171717;&quot;&gt;&lt;span&gt;2.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The ASP.NET MVC framework includes several action filters:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 1in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;o&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;OutputCache – This action filter caches the output of a controller action for a specified amount of time.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 1in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;o&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;HandleError – This action filter handles errors raised when a controller action executes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 1in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;o&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;Authorize – This action filter enables you to restrict access to a particular user or role.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;The ASP.NET MVC framework supports four different types of filters:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;1.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Authorization filters – Implements the&amp;nbsp;IAuthorizationFilter&amp;nbsp;attribute.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Authorization filters are used to implement authentication and authorization for controller actions. For example, the Authorize filter is an example of an Authorization filter.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;2.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Action filters – Implements the&amp;nbsp;IActionFilter&amp;nbsp;attribute.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Action filters contain logic that is executed before and after a controller action executes. You can use an action filter, for instance, to modify the view data that a controller action returns.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;The base&amp;nbsp;ActionFilterAttribute&amp;nbsp;class has the following methods that you can override:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;OnActionExecuting – This method is called before a controller action is executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;OnActionExecuted – This method is called after a controller action is executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;OnResultExecuting – This method is called before a controller action result is executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;OnResultExecuted – This method is called after a controller action result is executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;3.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Result filters – Implements the&amp;nbsp;IResultFilter&amp;nbsp;attribute.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Result filters contain logic that is executed before and after a view result is executed. For example, you might want to modify a view result right before the view is rendered to the browser.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;4.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Exception filters – Implements the&amp;nbsp;IExceptionFilter&amp;nbsp;attribute.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Exception filters are the last type of filter to run. You can use an exception filter to handle errors raised by either your controller actions or controller action results. You also can use exception filters to log errors.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 28.5pt;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0in 0.25in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Difference between static, constant and readonly&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraph&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span&gt;&lt;span&gt;1.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;Const&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0in 0.25in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Const is nothing but &quot;constant&quot;, a variable of which the value is constant but at compile time. And it&#39;s mandatory to assign a value to it. By default a const is static and we cannot change the value of a const variable throughout the entire program.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0in 0.25in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;A const field requires a value to be provided.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0in 0.25in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraph&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span&gt;&lt;span&gt;2.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;Readonly&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0in 0.25in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Readonly is the keyword whose value we can change during runtime or we can assign it at run time but only through the non-static constructor.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0in 0.25in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraph&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;span&gt;&lt;span&gt;3.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;Static ReadOnly&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0in 0.25in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;A Static Readonly type variable&#39;s value can be assigned at runtime or assigned at compile time and changed at runtime. But this variable&#39;s value can only be changed in the static constructor. And cannot be changed further. It can change only once at runtime.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0in 0.25in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 12pt; line-height: 18.4px;&quot;&gt;&lt;br clear=&quot;all&quot; style=&quot;break-before: page;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 7.5pt; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Main componenets of CLR:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Common Language Specification (CLS)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Common Type System (CTS)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Garbage Collection (GC)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Just In – Time Compiler (JIT)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 9pt; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Common Language Specification (CLS):&lt;/b&gt;It is responsible for converting the different .NET programming language syntactical rules and regulations into CLR understandable format. Basically, it provides the Language Interoperability. Language Interoperability means to provide the execution support to other programming languages also in .NET framework.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Language Interoperability can be achieved in two ways :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -27pt; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;i.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Managed Code:&amp;nbsp;The MSIL code which is managed by the CLR is known as the Managed Code. For managed code CLR provides&amp;nbsp;three&amp;nbsp;.NET facilities:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 0.75in; text-indent: -0.75in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;CAS(Code Access Security)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 0.75in; text-indent: -0.75in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Exception Handling&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 0.75in; text-indent: -0.75in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Automatic Memory Management.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -27pt; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;ii.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Unmanaged Code:&amp;nbsp;Before .NET development the programming language like .COM Components &amp;amp; Win32 API do not generate the MSIL code. So these are not managed by CLR rather managed by Operating System which is called unmanaged code.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 9pt; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Common Type System (CTS):&lt;/b&gt;Every programming language has its own data type system, so CTS is responsible for the understanding all the data type system of .NET programming languages and converting them into CLR understandable format which will be a common format.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;There are 2 Types of CTS that every .NET programming language have :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;a.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Value Types:&amp;nbsp;Value Types will directly store the value directly into the memory location. These types work with stack mechanism only. CLR allots memory for these at Compile Time.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;b.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Reference Types:&amp;nbsp;Reference Types will contain a memory address of value because the reference types won’t store the variable value directly in memory. These types work with Heap mechanism. CLR allots memory for these at Runtime.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Garbage Collector:&lt;/b&gt;It is used to provide the&amp;nbsp;Automatic Memory Management&amp;nbsp;feature. Suppose if there is no garbage collector then programmers have to write the memory management codes which will be a kind of overhead on programmers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;JIT(Just In Time Compiler):&lt;/b&gt;It is responsible for converting the CIL(Common Intermediate Language ) into machine code or native code using the Common Language Runtime environment.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Benefits of CLR:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;It improves the performance by providing a richly interact between programs at the run time.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Enhance portability by removing the need of recompiling a program on any operating system that supports it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Security also increases as it analyzes the MSIL instructions whether they are safe or unsafe. Also, the use of delegates in place of function pointers enhance the type safety and security.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Support automatic memory management with the help of Garbage Collector.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Provides cross-language integration because CTS inside CLR provides a common standard that activates the different languages to extend and share each other’s libraries.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Provides support to use the components that developed in other .NET programming languages.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Provide language, platform, and architecture independency.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin: 0in 0in 0in 27pt; text-indent: -0.25in; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;span&gt;·&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;It allows the creation of the scalable and multithreaded applications in an easier way as a developer has no need to think about the memory management and security issues.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 11pt; line-height: 16.8667px;&quot;&gt;&lt;br clear=&quot;all&quot; style=&quot;break-before: page;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;background: white; border-collapse: collapse; border: none; width: 0px;&quot;&gt;&lt;tbody&gt;&lt;tr style=&quot;height: 13.85pt;&quot;&gt;&lt;td style=&quot;background: rgb(198, 235, 217); border: 1pt solid rgb(95, 185, 98); height: 13.85pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;REF KEYWORD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(198, 235, 217); border: 1pt solid rgb(95, 185, 98); height: 13.85pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;OUT KEYWORD&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 27.75pt;&quot;&gt;&lt;td style=&quot;border: 1pt solid rgb(95, 185, 98); height: 27.75pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It is necessary the parameters should initialize before it pass to ref.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1pt solid rgb(95, 185, 98); border-left: none; border-right: 1pt solid rgb(95, 185, 98); border-top: none; height: 27.75pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It is not necessary to initialize parameters before it pass to out.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 28.1pt;&quot;&gt;&lt;td style=&quot;border: 1pt solid rgb(95, 185, 98); height: 28.1pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It is not necessary to initialize the value of a parameter before returning to the calling method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1pt solid rgb(95, 185, 98); border-left: none; border-right: 1pt solid rgb(95, 185, 98); border-top: none; height: 28.1pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It is necessary to initialize the value of a parameter before returning to the calling method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 41.7pt;&quot;&gt;&lt;td style=&quot;border: 1pt solid rgb(95, 185, 98); height: 41.7pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;The passing of value through ref parameter is useful when the called method also need to change the value of passed parameter.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1pt solid rgb(95, 185, 98); border-left: none; border-right: 1pt solid rgb(95, 185, 98); border-top: none; height: 41.7pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;The declaring of parameter through out parameter is useful when a method return multiple values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 27.75pt;&quot;&gt;&lt;td style=&quot;border: 1pt solid rgb(95, 185, 98); height: 27.75pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;When ref keyword is used the data may pass in bi-directional.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: 1pt solid rgb(95, 185, 98); border-left: none; border-right: 1pt solid rgb(95, 185, 98); border-top: none; height: 27.75pt; padding: 6pt;&quot; valign=&quot;bottom&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;When out keyword is used the data only passed in unidirectional.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Managed Code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;The code, which is developed in .NET framework, is known as managed code. This code is directly executed by CLR with help of managed code execution. Any language that is written in .NET Framework is managed code. CLR looks after your applications by managing memory.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Unmanaged Code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Applications that do not run under the control of the CLR are said to be unmanaged, and certain languages such as C++ can be used to write such applications.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Private:&lt;/b&gt;These members are available to containing type(class) it is not accessible to outside of the class.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Public :&lt;/b&gt;&amp;nbsp;These members are available to any where there is no restrictions.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Protected:&lt;/b&gt;&amp;nbsp;These members are available to the existing class as well as to the derived classes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Internal:&lt;/b&gt;&amp;nbsp;It is available anywhere within the containing assembly but gives a compile time error if it is accessed through different assembly.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Protected internal:&lt;/b&gt;&amp;nbsp;these members are available anywhere in the assembly and also to the other assembly to the derived class.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Boxing:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;1.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The process of Converting a Value Type (char, int etc.) to a Reference Type(object) is called Boxing.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;2.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Boxing is implicit conversion process in which object type (super type) is used.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;3.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The Value type is always stored in Stack. The Referenced Type is stored in Heap.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Example :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;int num = 23; // 23 will assigned to num&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Object Obj = num; // Boxing&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;UnBoxing:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;1.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The process of converting reference type into the value type is known as Unboxing.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&lt;span&gt;2.&lt;span style=&quot;font-size: 7pt; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;It is explicit conversion process.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Example :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;int num = 23;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// value type is int and assigned value 23&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Object Obj = num;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Boxing&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;int i = (int)Obj;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Unboxing&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 11pt; line-height: 16.8667px;&quot;&gt;&lt;br clear=&quot;all&quot; style=&quot;break-before: page;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Singleton Design Pattern:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;Singleton&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;Singleton obj;&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// private constructor to force use of&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// getInstance() to create Singleton object&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;Singleton() {}&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;Singleton getInstance()&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;(obj==null)&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;obj = new&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;Singleton();&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;obj;&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;What is the difference between “HTML.TextBox” and “HTML.TextBoxFor”?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Both provide the same HTML output, “HTML.TextBoxFor” is strongly typed while “HTML.TextBox” isn’t.&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;Below is a simple HTML code which just creates a simple textbox with “FirstName” as name.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Html.TextBox(&quot;FirstName &quot;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Below is “Html.TextBoxFor” code which creates HTML textbox using the property name ‘FirstName” from object “m”.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Html.TextBoxFor(m =&amp;gt; m.CustomerCode)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;In the same way, we have for other HTML controls like for checkbox we have “Html.CheckBox” and “Html.CheckBoxFor”.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;What is the difference between Temp data, View, and View Bag?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;In ASP.NET MVC there are three ways to pass/store data between the controllers and views.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;ViewData&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;ViewData is used to pass data from controller to view.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It is derived from ViewDataDictionary class.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It is available for the current request only.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Requires typecasting for complex data type and checks for null values to avoid error.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;If redirection occurs, then its value becomes null.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;ViewBag&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;ViewBag is also used to pass data from the controller to the respective view.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;ViewBag is a dynamic property that takes advantage of the new dynamic features in C# 4.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It is also available for the current request only.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;If redirection occurs, then its value becomes null.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Doesn’t require typecasting for complex data type.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;TempData&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;TempData is derived from TempDataDictionary class&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;TempData is used to pass data from the current request to the next request&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It keeps the information for the time of an HTTP Request. This means only from one page to another. It helps to maintain the data when we move from one controller to another controller or from one action to another action&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It requires typecasting for complex data type and checks for null values to avoid error. Generally, it is used to store only one time messages like the error messages and validation messages.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 11pt; line-height: 16.8667px;&quot;&gt;&lt;br clear=&quot;all&quot; style=&quot;break-before: page;&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;What is the use of Keep and Peek in “TempData”?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Once “TempData” is read in the current request it’s not available in the subsequent request. If we want “TempData” to be read and also available in the subsequent request then after reading we need to call “Keep” method as shown in the code below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;@TempData[&quot;MyData&quot;];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;TempData.Keep(&quot;MyData&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;The more shortcut way of achieving the same is by using “Peek”. This function helps to read as well advices MVC to maintain “TempData” for the subsequent request.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;string str = TempData.Peek(&quot;MyData &quot;).ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;background: white; border-collapse: collapse; width: 0px;&quot;&gt;&lt;tbody&gt;&lt;tr style=&quot;height: 9.35pt;&quot;&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Action Result&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Helper Method&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in; text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Description&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 9.75pt;&quot;&gt;&lt;td style=&quot;border: none; height: 9.75pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;ViewResult&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.75pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;View&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.75pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Renders a view&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 9.35pt;&quot;&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;PartialViewResult&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;PartialView&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Renders a partial view, which is a view which can be used inside another view.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 9.75pt;&quot;&gt;&lt;td style=&quot;border: none; height: 9.75pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;RedirectResult&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.75pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Redirect&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.75pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Redirects to different action method as specified in the URL.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 9.35pt;&quot;&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;RedirectToRouteResult&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;RedirectToRoute&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Redirects to another action method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 9.35pt;&quot;&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;ContentResult&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Content&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.35pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Returns the user supplied content type.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 9.75pt;&quot;&gt;&lt;td style=&quot;border: none; height: 9.75pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;JsonResult&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.75pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Json&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: none; height: 9.75pt; padding: 4.5pt 0in;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Returns a JSON object.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p style=&quot;font-family:verdana;&quot;&gt;You can find more blogs on our website: &lt;a style=&quot;text-decoration:none&quot; target=&quot;_blank&quot; href=&quot;https://www.trigyatechnologies.com/&quot;&gt;&lt;span style=&quot;color:#931B3D;&quot;&gt;Trigya Technologies&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://sanjaydgangurde.blogspot.com/feeds/732518253210627782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/csharp-mvc-interview-questions-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/732518253210627782'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/732518253210627782'/><link rel='alternate' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/csharp-mvc-interview-questions-and.html' title='CSharp MVC Interview Questions and Answers'/><author><name>Sanjay Gangurde</name><uri>http://www.blogger.com/profile/11280682843238530560</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//2.bp.blogspot.com/-_P2Drot4FVI/Xr6FDF6xNyI/AAAAAAAAA1g/y9r1SWcsFJQG7mzFfCi4y6tyXbz_Sm23QCK4BGAYYCw/s220/B612_20171203_073323.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-27y15ZMPGOA/XsIjhnGwVSI/AAAAAAAAA3Y/GKCfBj4WuX0FN-DtwcOLS7pRgBwgX-AdQCNcBGAsYHQ/s72-c/CInterview-Questions-and-Answers.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1034148257613744113.post-8730567953201027525</id><published>2020-05-18T10:53:00.003+05:30</published><updated>2020-05-30T18:25:00.472+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="encapsulation in java"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="object oriented programming"/><category scheme="http://www.blogger.com/atom/ns#" term="oop in c"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server management studio"/><title type='text'>Interview Questions on CSharp Basics</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt; &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-UWmeLU2JsjU/XsImPVfuMFI/AAAAAAAAA3s/cyAOvvr8vQkpRLX7Nii5MvqAiDCHJSb-wCNcBGAsYHQ/s1600/maxresdefault.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;CSharp Basics Questions and Answers&quot; border=&quot;0&quot; data-original-height=&quot;720&quot; data-original-width=&quot;1280&quot; height=&quot;225&quot; src=&quot;https://1.bp.blogspot.com/-UWmeLU2JsjU/XsImPVfuMFI/AAAAAAAAA3s/cyAOvvr8vQkpRLX7Nii5MvqAiDCHJSb-wCNcBGAsYHQ/s400/maxresdefault.jpg&quot; title=&quot;Interview Questions on CSharp Basics&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;1. Can You Allow A Class To Be Inherited, But Prevent A Method From Being Overridden In C#?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :Yes. By Declaring the class public and making the method sealed.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;2. You Declare An Overridden Method To Be Static If The Original Method Is Not Static?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :No. Two virtual methods must have the same signature.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;3. Can You Inherit Private Members Of A Class?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :No, we cannot inherit private members of a class because private members&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;are accessible only to that class and not outside that class&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;4. Is It Possible To Execute Two Catch Blocks?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :No. Whenever, an exception occurs in your program,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;the correct catch block is executed and the control goes to the finally block.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;5. Can You Prevent A Class From Overriding?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :Yes. You can prevent a class from overriding in C# by using the sealed keyword;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;6. What Is &#39;this&#39; Pointer?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :&#39;this&#39; pointer refers to the current object of a class.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;7. Can &#39;this&#39; Be Used Within A Static Method?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :No.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;8. Is It Possible For A Class To Inherit The Constructor Of Its Base Class?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :No. A class cannot inherit the constructor of its base class.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;9. What&#39;s The Difference Between The &#39;ref&#39; And &#39;out&#39; Keywords?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :An argument passed as &quot;ref&quot; must be initialized before passing to the method&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;whereas &quot;out&quot; parameter needs not to be initialized before passing to a method,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;and it will be initialized inside the method.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;10. Difference Between Const, Readonly And Static Readonly In C# ?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Ans :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;1)Constant variables are declared and initialized at compile time. The value can&#39;t be changed after words.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;2)Readonly variables will be initialized only from the non-static constructor of the same class.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;3)Static Readonly variables will be initialized only from the static constructor of the same class.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style=&quot;font-family:verdana;&quot;&gt;You can find more blogs on our website: &lt;a style=&quot;text-decoration:none&quot; target=&quot;_blank&quot; href=&quot;https://www.trigyatechnologies.com/&quot;&gt;&lt;span style=&quot;color:#931B3D;&quot;&gt;Trigya Technologies&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://sanjaydgangurde.blogspot.com/feeds/8730567953201027525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/interview-questions-on-csharp-basics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/8730567953201027525'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/8730567953201027525'/><link rel='alternate' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/interview-questions-on-csharp-basics.html' title='Interview Questions on CSharp Basics'/><author><name>Sanjay Gangurde</name><uri>http://www.blogger.com/profile/11280682843238530560</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//2.bp.blogspot.com/-_P2Drot4FVI/Xr6FDF6xNyI/AAAAAAAAA1g/y9r1SWcsFJQG7mzFfCi4y6tyXbz_Sm23QCK4BGAYYCw/s220/B612_20171203_073323.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-UWmeLU2JsjU/XsImPVfuMFI/AAAAAAAAA3s/cyAOvvr8vQkpRLX7Nii5MvqAiDCHJSb-wCNcBGAsYHQ/s72-c/maxresdefault.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1034148257613744113.post-8272165187517713661</id><published>2020-05-17T19:44:00.006+05:30</published><updated>2020-05-30T18:25:13.270+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="encapsulation in java"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="object oriented programming"/><category scheme="http://www.blogger.com/atom/ns#" term="oop in c"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server management studio"/><title type='text'>Singleton Design Pattern</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Singleton Design Pattern:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;The Singleton pattern ensures that a class has only one instance and provides a global point of access to it.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-BYZZY0FoiaE/XsIlqnFDEDI/AAAAAAAAA3k/bB9usn8T2ywI9dYaf1Z038egSjPs2fTmwCNcBGAsYHQ/s1600/leetcode-2.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Singleton Design Pattern by Sanjay D Gangurde&quot; border=&quot;0&quot; data-original-height=&quot;315&quot; data-original-width=&quot;560&quot; height=&quot;225&quot; src=&quot;https://1.bp.blogspot.com/-BYZZY0FoiaE/XsIlqnFDEDI/AAAAAAAAA3k/bB9usn8T2ywI9dYaf1Z038egSjPs2fTmwCNcBGAsYHQ/s400/leetcode-2.png&quot; title=&quot;Singleton Design Pattern by Sanjay D Gangurde&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Standard Singleton implementation&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;To ensure the class has only one instance, we mark the constructor as private.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;So, we can only instantiate this class from within the class.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;We create a static variable that will hold the instance of the class.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Then, we create a static method that provides the instance of the singleton class.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;This method checks if an instance of the singleton class is available.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;It creates an instance, if its not available; Otherwise, it returns the available instance.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public class Singleton {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static Singleton instance;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private Singleton() {}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static Singleton GetInstance(){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(instance == null){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return instance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public class Singleton {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;private static Singleton instance;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;private Singleton() {}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;public static Singleton GetInstance(){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;if(instance == null){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;return instance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Issues with the standard implementation&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;The standard singleton implementation code works fine in Single threaded environment.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;But in multithreaded environment, the GetInstance() code breaks :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public static Singleton GetInstance(){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;if(instance == null){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return instance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public static Singleton GetInstance(){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;if(instance == null){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;return instance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;If two threads enter the if condition at the same time, then two instances of Singleton will be created.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Handling Multithreading issue with standard singleton implementation&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;We can synchronize the method. So that only one thread can access it at a time.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;In the below implementation, the thread locks out the shared object,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;and then checks whether or not the instance has been created before creating the instance.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;public sealed class Singleton&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static Singleton instance = null;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static readonly object Instancelock = new object();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Singleton() {}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static Singleton GetInstance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lock (Instancelock)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (instance == null)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return instance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;public sealed class Singleton&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static Singleton instance = null;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static readonly object Instancelock = new object();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Singleton() {}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static Singleton GetInstance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lock (Instancelock)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (instance == null)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return instance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;This solves the multithreading issue. But it is slow since only one thread can access GetInstance() method&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;at a time.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;We can use following approaches for this :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;1: Double checked locking&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;In this approach, we first check if the instance is created. If not, we synchronize.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public sealed class Singleton&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static Singleton instance = null;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static readonly object Instancelock = new object();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Singleton() {}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static Singleton GetInstance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (instance == null)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lock (Instancelock)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (instance == null)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return instance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public sealed class Singleton&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static Singleton instance = null;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static readonly object Instancelock = new object();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private Singleton() {}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static Singleton GetInstance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (instance == null)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lock (Instancelock)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (instance == null)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return instance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;2: Early instance creation&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;We can choose to create the instance of Singleton class when the class is loaded.This is thread-safe without using locking.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public class EarlySingleton {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;//create instance eagerly&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private static EarlySingleton instance = new EarlySingleton();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;private EarlySingleton() {}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;public static EarlySingleton GetInstance(){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;return instance;//just return the instance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public class EarlySingleton {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;//create instance eagerly&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;private static EarlySingleton instance = new EarlySingleton();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;private EarlySingleton() {}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;public static EarlySingleton GetInstance(){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;return instance;//just return the instance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;3: Fully Lazy Instantiation&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Here, instantiation is triggered by the first reference to the static member of the GetInstance class,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;which only occurs in Instance.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public sealed class Singleton&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; private Singleton()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; public static Singleton GetInstance { get { return GetInstance.instance; } }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; private class GetInstance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Explicit static constructor to tellcompiler&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // not to mark type as beforefieldinit&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static GetInstance()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; internal static readonly Singleton instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public sealed class Singleton&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; private Singleton()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; public static Singleton GetInstance { get { return GetInstance.instance; } }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; private class GetInstance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Explicit static constructor to tellcompiler&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // not to mark type as beforefieldinit&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static GetInstance()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; internal static readonly Singleton instance = new Singleton();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;4: Singleton Implementation using Generics&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;This will give you a single instance and will effectively be lazy,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;because the static constructor doesn’t get called until Build() is called.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public class GenericSingleton&amp;lt;T&amp;gt; where T : new()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static T ms_StaticInstance = new T();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public T GetInstance()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ms_StaticInstance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; GenericSingleton&amp;lt;SimpleType&amp;gt; instance = new GenericSingleton&amp;lt;SimpleType&amp;gt;();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; SimpleType simple = instance.GetInstance();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public class GenericSingleton&amp;lt;T&amp;gt; where T : new()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static T ms_StaticInstance = new T();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public T GetInstance()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ms_StaticInstance;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; GenericSingleton&amp;lt;SimpleType&amp;gt; instance = new GenericSingleton&amp;lt;SimpleType&amp;gt;();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; SimpleType simple = instance.GetInstance();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;5: using Lazy&amp;lt;T&amp;gt; type&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;You need to pass a delegate to the constructor which calls the Singleton constructor –&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;which is done most easily with a lambda expression.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public sealed class Singleton&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; private static readonly Lazy&amp;lt;Singleton&amp;gt; lazy =&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new Lazy&amp;lt;Singleton&amp;gt;(() =&amp;gt; new Singleton());&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; public static Singleton GetInstance { get { return lazy.Value; } }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; private Singleton()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;public sealed class Singleton&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; private static readonly Lazy&amp;lt;Singleton&amp;gt; lazy =&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new Lazy&amp;lt;Singleton&amp;gt;(() =&amp;gt; new Singleton());&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; public static Singleton GetInstance { get { return lazy.Value; } }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; private Singleton()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Even though we avoided multiple instance creation of singleton class&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;by using Double checked locking or Eager instance creation, instances can still be created by :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– cloning&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– reflection&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– Sub-classing singleton class&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;How to avoid Singleton instance creation by cloning ?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;We can create a copy of an object using clone() method.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;To avoid creating a clone of our singleton class, we can do the following :&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– Implement MethodwiseClone()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– Override the clone() method and throw CloneNotSupportedException from it.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;protected object MemberwiseClone()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new Exception(&quot;Cloning a singleton object is not allowed&quot;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;How to avoid Singleton class instance creation through Reflection ?&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;To avoid instance creation through reflection, throw an exception from constructor if it already has an instance.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;private Singleton()&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (instance != null)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new Exception(&quot;Cannot create singleton instance through reflection&quot;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;How to avoid a subclass creating singleton instance ?&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;If you just provide a private constructor, a subclass cannot instantiate it to create another instance.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Uses of Singleton Design Pattern :&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Logger :&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Singleton pattern is a good option for the Logger class when we want to create&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;one log file with the logged messages.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;If we have more than one instances of Logger in the application,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;a new log will be created with every instance.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Cache :&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;We can use Singleton pattern to implement caches as that provides a single global access to it.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Why singleton pattern is considered an Anti-pattern ?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– Singletons aren’t easy to handle with unit tests. You can’t control their instantiation and they may retain state across invocations.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– Memory allocated to an Singleton can’t be freed.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– In multithreaded environment, access to the singleton object may have to be guarded (e.g. via synchronization).&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– Singletons promote tight coupling between classes, so it is hard to test&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;Difference between Static class and Singleton Pattern:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– In c# a static class cannot implement an interface. When a single instance class needs to implement an interface for some business reason or IoC purposes, you can use the Singleton pattern without a static class.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– You can clone the object of Singleton but, you can not clone the static class object&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– Singleton object stores in Heap but, static object stores in stack&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;– A singleton can be initialized lazily or asynchronously while a static class is generally initialized when it is first loaded&lt;/span&gt;&lt;br /&gt;&lt;p style=&quot;font-family:verdana;&quot;&gt;You can find more blogs on our website: &lt;a style=&quot;text-decoration:none&quot; target=&quot;_blank&quot; href=&quot;https://www.trigyatechnologies.com/&quot;&gt;&lt;span style=&quot;color:#931B3D;&quot;&gt;Trigya Technologies&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://sanjaydgangurde.blogspot.com/feeds/8272165187517713661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/singleton-design-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/8272165187517713661'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/8272165187517713661'/><link rel='alternate' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/singleton-design-pattern.html' title='Singleton Design Pattern'/><author><name>Sanjay Gangurde</name><uri>http://www.blogger.com/profile/11280682843238530560</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//2.bp.blogspot.com/-_P2Drot4FVI/Xr6FDF6xNyI/AAAAAAAAA1g/y9r1SWcsFJQG7mzFfCi4y6tyXbz_Sm23QCK4BGAYYCw/s220/B612_20171203_073323.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-BYZZY0FoiaE/XsIlqnFDEDI/AAAAAAAAA3k/bB9usn8T2ywI9dYaf1Z038egSjPs2fTmwCNcBGAsYHQ/s72-c/leetcode-2.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1034148257613744113.post-2610202839087134020</id><published>2020-05-16T17:31:00.003+05:30</published><updated>2020-05-30T18:25:22.593+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="encapsulation in java"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="object oriented programming"/><category scheme="http://www.blogger.com/atom/ns#" term="oop in c"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server management studio"/><title type='text'>Custom Format Data Export to Excel in C#</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt; &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-uvQKp8wTHpU/XsImxHoDgnI/AAAAAAAAA30/tPCCrEPZ4Bkq5YawFQOWzEN0aOJ3ID4LwCNcBGAsYHQ/s1600/6-ways-to-export-data-to-excel.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Custom Format Data Export to Excel in C#&quot; border=&quot;0&quot; data-original-height=&quot;334&quot; data-original-width=&quot;596&quot; height=&quot;223&quot; src=&quot;https://1.bp.blogspot.com/-uvQKp8wTHpU/XsImxHoDgnI/AAAAAAAAA30/tPCCrEPZ4Bkq5YawFQOWzEN0aOJ3ID4LwCNcBGAsYHQ/s400/6-ways-to-export-data-to-excel.png&quot; title=&quot;Custom Format Data Export to Excel in C#&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Hello Everyone,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Most of Developers working around the world faces a scenario where they need to export the data from database to Excel. So today, i will show you how to export the data into excel in C#.&lt;br /&gt;These are easy steps to export and display the data into&amp;nbsp;custom design to excel using C#.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Here are the easy steps,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;1. Open the Visual Studio and Create new Website/Web Application&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;2. Here I&#39;ve added a button (Export) on my Default.aspx page,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-Bu1BE-3r80U/Xr_ThXS0kqI/AAAAAAAAA2w/XkW7R9bN4hQM3DWfo4ynO1ix4zxsMibQgCNcBGAsYHQ/s1600/1.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Custom Format Data Export to Excel in C#&quot; border=&quot;0&quot; data-original-height=&quot;566&quot; data-original-width=&quot;958&quot; height=&quot;235&quot; src=&quot;https://1.bp.blogspot.com/-Bu1BE-3r80U/Xr_ThXS0kqI/AAAAAAAAA2w/XkW7R9bN4hQM3DWfo4ynO1ix4zxsMibQgCNcBGAsYHQ/s400/1.png&quot; title=&quot;Custom Format Data Export to Excel in C#&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;3. In the code behind, Add the required namespace,&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-RD3Eev8zlhI/Xr_TihiZYvI/AAAAAAAAA3I/5EaBb_WOfM8jKyXqO7U9Cyx-Juzl63LuwCPcBGAYYCw/s1600/5.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Custom Format Data Export to Excel in C#&quot; border=&quot;0&quot; data-original-height=&quot;20&quot; data-original-width=&quot;165&quot; height=&quot;23&quot; src=&quot;https://1.bp.blogspot.com/-RD3Eev8zlhI/Xr_TihiZYvI/AAAAAAAAA3I/5EaBb_WOfM8jKyXqO7U9Cyx-Juzl63LuwCPcBGAYYCw/s200/5.png&quot; title=&quot;Custom Format Data Export to Excel in C#&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;4. Create a object of class StringBuilder as shown below,&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-VEt0PqlIB-E/Xr_TiQAoz4I/AAAAAAAAA3Q/rZOnWoolGggZVXX-j1ACrd29O91fMZ6PgCPcBGAYYCw/s1600/4.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Custom Format Data Export to Excel in C#&quot; border=&quot;0&quot; data-original-height=&quot;49&quot; data-original-width=&quot;438&quot; height=&quot;43&quot; src=&quot;https://1.bp.blogspot.com/-VEt0PqlIB-E/Xr_TiQAoz4I/AAAAAAAAA3Q/rZOnWoolGggZVXX-j1ACrd29O91fMZ6PgCPcBGAYYCw/s400/4.png&quot; title=&quot;Custom Format Data Export to Excel in C#&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;5. Add the below source code for Button click event,&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-hrUQ0im73vo/Xr_ThUQT0xI/AAAAAAAAA3M/9_9xhd6Ii6QSZMSqzqmw8FzTVakG9FgbACPcBGAYYCw/s1600/2.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Custom Format Data Export to Excel in C#&quot; border=&quot;0&quot; data-original-height=&quot;188&quot; data-original-width=&quot;703&quot; height=&quot;106&quot; src=&quot;https://1.bp.blogspot.com/-hrUQ0im73vo/Xr_ThUQT0xI/AAAAAAAAA3M/9_9xhd6Ii6QSZMSqzqmw8FzTVakG9FgbACPcBGAYYCw/s400/2.png&quot; title=&quot;Custom Format Data Export to Excel in C#&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;6. Create content to display in an excel,&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-tAUVdjIsXO8/Xr_ThmAIr9I/AAAAAAAAA3Q/4iYipp7hA_M2GJj5hS8By7B15P-jNPMLACPcBGAYYCw/s1600/3.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Custom Format Data Export to Excel in C#&quot; border=&quot;0&quot; data-original-height=&quot;683&quot; data-original-width=&quot;986&quot; height=&quot;276&quot; src=&quot;https://1.bp.blogspot.com/-tAUVdjIsXO8/Xr_ThmAIr9I/AAAAAAAAA3Q/4iYipp7hA_M2GJj5hS8By7B15P-jNPMLACPcBGAYYCw/s400/3.png&quot; title=&quot;Custom Format Data Export to Excel in C#&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;7. Run the Application, you will find the below mentioned output,&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-XHFZVbGJTsw/Xr_TjAoAj-I/AAAAAAAAA3M/qTBLDGUhWaYbI6DwMcDIaookRL5B58DXgCPcBGAYYCw/s1600/6.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Custom Format Data Export to Excel in C#&quot; border=&quot;0&quot; data-original-height=&quot;748&quot; data-original-width=&quot;977&quot; height=&quot;305&quot; src=&quot;https://1.bp.blogspot.com/-XHFZVbGJTsw/Xr_TjAoAj-I/AAAAAAAAA3M/qTBLDGUhWaYbI6DwMcDIaookRL5B58DXgCPcBGAYYCw/s400/6.png&quot; title=&quot;Custom Format Data Export to Excel in C#&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: small;&quot;&gt;Please post your comments and Queries if you have any queries in SQL Server.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; color: #222222; font-family: arial, tahoma, helvetica, freesans, sans-serif; font-size: 13.2px;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: small;&quot;&gt;Thank You!&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: small;&quot;&gt;Connect me on:&amp;nbsp;&lt;a href=&quot;https://www.facebook.com/SanjuDGangurde&quot; style=&quot;color: #888888; text-decoration-line: none;&quot; target=&quot;_blank&quot;&gt;Facebook&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;https://twitter.com/SanjayDGangurde&quot; style=&quot;color: #888888; text-decoration-line: none;&quot; target=&quot;_blank&quot;&gt;Twitter&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;https://www.instagram.com/sanjay.gangurde/&quot; style=&quot;color: #888888; text-decoration-line: none;&quot; target=&quot;_blank&quot;&gt;Instagram&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style=&quot;font-family:verdana;&quot;&gt;You can find more blogs on our website: &lt;a style=&quot;text-decoration:none&quot; target=&quot;_blank&quot; href=&quot;https://www.trigyatechnologies.com/&quot;&gt;&lt;span style=&quot;color:#931B3D;&quot;&gt;Trigya Technologies&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://sanjaydgangurde.blogspot.com/feeds/2610202839087134020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/custom-format-data-export-to-excel-in-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/2610202839087134020'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/2610202839087134020'/><link rel='alternate' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/custom-format-data-export-to-excel-in-c.html' title='Custom Format Data Export to Excel in C#'/><author><name>Sanjay Gangurde</name><uri>http://www.blogger.com/profile/11280682843238530560</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//2.bp.blogspot.com/-_P2Drot4FVI/Xr6FDF6xNyI/AAAAAAAAA1g/y9r1SWcsFJQG7mzFfCi4y6tyXbz_Sm23QCK4BGAYYCw/s220/B612_20171203_073323.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-uvQKp8wTHpU/XsImxHoDgnI/AAAAAAAAA30/tPCCrEPZ4Bkq5YawFQOWzEN0aOJ3ID4LwCNcBGAsYHQ/s72-c/6-ways-to-export-data-to-excel.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1034148257613744113.post-4818763312169003220</id><published>2020-05-16T10:31:00.004+05:30</published><updated>2020-05-30T18:25:32.700+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="encapsulation in java"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="object oriented programming"/><category scheme="http://www.blogger.com/atom/ns#" term="oop in c"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server management studio"/><title type='text'>SQL Query optimization techniques in SQL Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;  &lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-ROGPHhfgKKw/XsIn0-oBb8I/AAAAAAAAA38/yCb3f2iXpy0Pr_w2dzwBGkHvxR7peQkLQCNcBGAsYHQ/s1600/SQL-query-optimization-770x300.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;300&quot; data-original-width=&quot;770&quot; height=&quot;155&quot; src=&quot;https://1.bp.blogspot.com/-ROGPHhfgKKw/XsIn0-oBb8I/AAAAAAAAA38/yCb3f2iXpy0Pr_w2dzwBGkHvxR7peQkLQCNcBGAsYHQ/s400/SQL-query-optimization-770x300.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Sql Statements (queries) are used to retrieve data from the database. The best query is important when performance is considered for that SQL query tuning is required.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Here are the few techniques which we can use regularly use to optimize the query,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;1. The sql query becomes faster if you specify columns names in SELECT statement instead of than &#39;*&#39;.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Eg:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT [ProductID]&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ,[Title]&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ,[ProductName]&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ,[ProductDesp]&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; ,[ProdImage]&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM [dbo].[ProductDetails]&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Instead of:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT *&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM [dbo].[ProductDetails]&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;2.&amp;nbsp;HAVING clause is used to filter the rows after all the rows are selected. Do not use HAVING clause for any other purposes.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Eg:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT ProductName, count(ProductName)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM ProductDetails&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;WHERE Title != &#39;Copper&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;AND Title != &#39;Silver&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;GROUP BY Title;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Instead of:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT ProductName, count(ProductName)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM ProductDetails&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;GROUP BY Title&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;HAVING Title!= &#39;Copper&#39; AND Title!= &#39;Silver&#39;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;3.&amp;nbsp;There can be more than one subqueries in your main query. Try to minimize the number of subquery block in your query.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;For Eg:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT Name&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM Students&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;WHERE (score, age ) = (SELECT MAX (score), MAX (age)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM StudentsDetails)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;AND dept = &#39;Electronics&#39;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Instead of:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT Name&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM Students&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;WHERE score = (SELECT MAX(score) FROM StudentsDetails)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;AND age = (SELECT MAX(age) FROM StudentsDetails)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;AND dept = &#39;Electronics&#39;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;4. Use operator EXISTS, IN and table joins in a query.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;a) Usually IN has the slowest performance.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;b) IN is efficient when most of the filter criteria is in the sub-query.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;c) EXISTS is efficient when most of the filter criteria is in the main query.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;For Eg&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Select * from ProductDetails p&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;where EXISTS (select * from Items o&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;where o.ProductId = p.ProductId)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Instead of:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Select * from ProductDetails p&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;where ProductId IN&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;(select ProductId from Items)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;5. Use EXISTS instead of DISTINCT when using joins which involves tables having one-to-many relationship.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;For Eg:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT d.dept_id, d.dept&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM dept d&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;WHERE EXISTS ( SELECT &#39;X&#39; FROM employee e WHERE e.dept = d.dept);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Instead of:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT DISTINCT d.dept_id, d.dept&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM dept d,employee e&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;WHERE e.dept = e.dept;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;6. Try to use UNION ALL in place of UNION.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;For Eg:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT id, first_name&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM student_details_class10&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;UNION ALL&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT id, first_name&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM sports_team;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Instead of:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT id, first_name, subject&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM student_details_class10&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;UNION&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT id, first_name&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM sports_team;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;7. Be careful while using conditions in WHERE clause.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;For Eg:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT id, first_name, age FROM student_details WHERE age &amp;gt; 10;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Instead of:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT id, first_name, age FROM student_details WHERE age != 10;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;8. Instead of using Temp Table using Table Variable to store data temporary if you don&#39;t have record more than 1000 to read the data.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Eg:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT ProductName,Category,Description FROM @TempProduct&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Instead&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT ProductName,Category,Description FROM #TempProduct&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;9.&amp;nbsp;Avoid LIKE searches with prefix wildcards&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Eg:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;SELECT&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; ProductName,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; Category&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;FROM&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; ProductDetails&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;WHERE&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; ProductName LIKE &#39;%Mar%&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;Having a wildcard &#39;%&#39; at the beginning of the pattern will prevent the database from using an index for this column&#39;s search. Such searches can take a while.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;10. Apply Indexes on tables wherever required.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;1. Clustered Index (By Default on Primary Key Column is applied)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;b&gt;2. Non Clustered Index&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: small;&quot;&gt;Please post your comments and Queries if you have any queries in SQL Server.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: small;&quot;&gt;Thank You!&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: verdana, sans-serif;&quot;&gt;Connect me on:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.facebook.com/SanjuDGangurde&quot; style=&quot;background-color: white; color: #888888; font-family: verdana, sans-serif;&quot; target=&quot;_blank&quot;&gt;Facebook&lt;/a&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: verdana, sans-serif;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://twitter.com/SanjayDGangurde&quot; style=&quot;background-color: white; color: #888888; font-family: verdana, sans-serif;&quot; target=&quot;_blank&quot;&gt;Twitter&lt;/a&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: verdana, sans-serif;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://www.instagram.com/sanjay.gangurde/&quot; style=&quot;background-color: white; color: #888888; font-family: verdana, sans-serif;&quot; target=&quot;_blank&quot;&gt;Instagram&lt;/a&gt;&lt;span style=&quot;background-color: white; color: #222222; font-family: verdana, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style=&quot;font-family:verdana;&quot;&gt;You can find more blogs on our website: &lt;a style=&quot;text-decoration:none&quot; target=&quot;_blank&quot; href=&quot;https://www.trigyatechnologies.com/&quot;&gt;&lt;span style=&quot;color:#931B3D;&quot;&gt;Trigya Technologies&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://sanjaydgangurde.blogspot.com/feeds/4818763312169003220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/sql-query-optimization-techniques-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/4818763312169003220'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/4818763312169003220'/><link rel='alternate' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/sql-query-optimization-techniques-in.html' title='SQL Query optimization techniques in SQL Server'/><author><name>Sanjay Gangurde</name><uri>http://www.blogger.com/profile/11280682843238530560</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//2.bp.blogspot.com/-_P2Drot4FVI/Xr6FDF6xNyI/AAAAAAAAA1g/y9r1SWcsFJQG7mzFfCi4y6tyXbz_Sm23QCK4BGAYYCw/s220/B612_20171203_073323.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-ROGPHhfgKKw/XsIn0-oBb8I/AAAAAAAAA38/yCb3f2iXpy0Pr_w2dzwBGkHvxR7peQkLQCNcBGAsYHQ/s72-c/SQL-query-optimization-770x300.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1034148257613744113.post-6809226252519814783</id><published>2020-05-15T17:31:00.001+05:30</published><updated>2020-05-30T18:25:42.379+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="c#"/><category scheme="http://www.blogger.com/atom/ns#" term="c# tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="encapsulation in java"/><category scheme="http://www.blogger.com/atom/ns#" term="MVC"/><category scheme="http://www.blogger.com/atom/ns#" term="object oriented programming"/><category scheme="http://www.blogger.com/atom/ns#" term="oop in c"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="sql server management studio"/><title type='text'>How to Set Keyboard Shortcuts in SQL Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt; &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-ROGPHhfgKKw/XsIn0-oBb8I/AAAAAAAAA4A/3juY1jY2ddsNjjecJtG1QUi0mTN6lcjogCPcBGAYYCw/s1600/SQL-query-optimization-770x300.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;How to Set Keyboard Shortcuts in SQL Server&quot; border=&quot;0&quot; data-original-height=&quot;300&quot; data-original-width=&quot;770&quot; height=&quot;155&quot; src=&quot;https://1.bp.blogspot.com/-ROGPHhfgKKw/XsIn0-oBb8I/AAAAAAAAA4A/3juY1jY2ddsNjjecJtG1QUi0mTN6lcjogCPcBGAYYCw/s400/SQL-query-optimization-770x300.png&quot; title=&quot;How to Set Keyboard Shortcuts in SQL Server&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;Web Developers/SQL Developers usually face challenges in writing SQL Queries again and again during development and updating the new and existing system.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;So, Today i will show you few techniques which will be used to solve the problem and accomplish the task more efficiently.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;To set the Keyboard Shortcuts in SQL Server. Please find below steps,&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&lt;b&gt;Step 1: Go To Tools Menu&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-NvsTgPk3tgU/Xr6KpYTFpkI/AAAAAAAAA2U/9BmEoyO6nPImC1-pxqHGSdeREH5fgSqDACPcBGAYYCw/s1600/1.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;420&quot; data-original-width=&quot;887&quot; height=&quot;189&quot; src=&quot;https://1.bp.blogspot.com/-NvsTgPk3tgU/Xr6KpYTFpkI/AAAAAAAAA2U/9BmEoyO6nPImC1-pxqHGSdeREH5fgSqDACPcBGAYYCw/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&lt;b&gt;Steps 2: Select Options from Tools Menu&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-O8BDdmp4W90/Xr6KpE6i3cI/AAAAAAAAA2Q/CWHsn-E-uLUS6ZWcRbdMTVa8R0dfSme0wCPcBGAYYCw/s1600/2.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;How to Set Keyboard Shortcuts in SQL Server&quot; border=&quot;0&quot; data-original-height=&quot;484&quot; data-original-width=&quot;1076&quot; height=&quot;177&quot; src=&quot;https://1.bp.blogspot.com/-O8BDdmp4W90/Xr6KpE6i3cI/AAAAAAAAA2Q/CWHsn-E-uLUS6ZWcRbdMTVa8R0dfSme0wCPcBGAYYCw/s400/2.png&quot; title=&quot;How to Set Keyboard Shortcuts in SQL Server&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div&gt;&lt;b style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;b style=&quot;font-family: verdana, sans-serif;&quot;&gt;Step 3: Select Keyboard -&amp;gt; Query Shortcuts&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-Rf8WFvThVPQ/Xr6KpFv70KI/AAAAAAAAA2M/MpX5-7SAUTASSrRKGGnsG2bG_sxpQnfGwCPcBGAYYCw/s1600/3.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;How to Set Keyboard Shortcuts in SQL Server&quot; border=&quot;0&quot; data-original-height=&quot;600&quot; data-original-width=&quot;1256&quot; height=&quot;190&quot; src=&quot;https://1.bp.blogspot.com/-Rf8WFvThVPQ/Xr6KpFv70KI/AAAAAAAAA2M/MpX5-7SAUTASSrRKGGnsG2bG_sxpQnfGwCPcBGAYYCw/s400/3.png&quot; title=&quot;How to Set Keyboard Shortcuts in SQL Server&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&lt;b&gt;Step 4: Add the Shortcuts and Press OK&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-FYpTugeomJI/Xr6Kpw4BucI/AAAAAAAAA2Y/w_NBEAWaawYE7ok4xEWGl1g8GM8o4IQAwCPcBGAYYCw/s1600/4.png&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;How to Set Keyboard Shortcuts in SQL Server&quot; border=&quot;0&quot; data-original-height=&quot;606&quot; data-original-width=&quot;1377&quot; height=&quot;175&quot; src=&quot;https://1.bp.blogspot.com/-FYpTugeomJI/Xr6Kpw4BucI/AAAAAAAAA2Y/w_NBEAWaawYE7ok4xEWGl1g8GM8o4IQAwCPcBGAYYCw/s400/4.png&quot; title=&quot;How to Set Keyboard Shortcuts in SQL Server&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;The Shortcuts will be saved.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;You can open a new query window and type table name and press Ctrl + 3 by selecting the table name your query for SELECT * FROM &lt;i&gt;TableName&amp;nbsp;&lt;/i&gt;&amp;nbsp;will be fired.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;Please post your comments and Queries if you have any queries in SQL Server.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;Thank You!&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: xx-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: medium;&quot;&gt;Connect me on: &lt;a href=&quot;https://www.facebook.com/SanjuDGangurde&quot; target=&quot;_blank&quot;&gt;Facebook&lt;/a&gt;, &lt;a href=&quot;https://twitter.com/SanjayDGangurde&quot; target=&quot;_blank&quot;&gt;Twitter&lt;/a&gt;, &lt;a href=&quot;https://www.instagram.com/sanjay.gangurde/&quot; target=&quot;_blank&quot;&gt;Instagram&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style=&quot;font-family:verdana;&quot;&gt;You can find more blogs on our website: &lt;a style=&quot;text-decoration:none&quot; target=&quot;_blank&quot; href=&quot;https://www.trigyatechnologies.com/&quot;&gt;&lt;span style=&quot;color:#931B3D;&quot;&gt;Trigya Technologies&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://sanjaydgangurde.blogspot.com/feeds/6809226252519814783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/how-to-set-keyboard-shortcuts-in-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/6809226252519814783'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1034148257613744113/posts/default/6809226252519814783'/><link rel='alternate' type='text/html' href='https://sanjaydgangurde.blogspot.com/2020/05/how-to-set-keyboard-shortcuts-in-sql.html' title='How to Set Keyboard Shortcuts in SQL Server'/><author><name>Sanjay Gangurde</name><uri>http://www.blogger.com/profile/11280682843238530560</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//2.bp.blogspot.com/-_P2Drot4FVI/Xr6FDF6xNyI/AAAAAAAAA1g/y9r1SWcsFJQG7mzFfCi4y6tyXbz_Sm23QCK4BGAYYCw/s220/B612_20171203_073323.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-ROGPHhfgKKw/XsIn0-oBb8I/AAAAAAAAA4A/3juY1jY2ddsNjjecJtG1QUi0mTN6lcjogCPcBGAYYCw/s72-c/SQL-query-optimization-770x300.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>