<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Sanjeetosphere</title><link>http://blogs.msdn.com/sanjeets/default.aspx</link><description>Sanjeet's technical outbursts.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Coherence With .Net</title><link>http://blogs.msdn.com/sanjeets/archive/2008/07/09/coherence-with-net.aspx</link><pubDate>Wed, 09 Jul 2008 11:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8711884</guid><dc:creator>Sanjeet</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/8711884.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=8711884</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=8711884</wfw:comment><description>

&lt;p&gt;In one of my recent
projects I was implementing Enterprise level caching using &lt;a href="http://www.oracle.com/products/middleware/coherence/index.html" target="_blank" title="Coherence" id="i-lb"&gt;Coherence&lt;/a&gt;. &lt;br id="zbk:"&gt;
&lt;br id="zbk:0"&gt;
As you might be aware its written in Java and expects all the objects
(that needs to be cached in it) in a Portable Object Format. This is to allow
interoperability and platform independence. If the client is Java, the &lt;a href="http://wiki.tangosol.com/display/COHNET32/Home" target="_blank" title="POF" id="i1uu"&gt;POF&lt;/a&gt; isn't mandatory, however if
its .Net it is mandatory.&lt;br id="zbk:1"&gt;
&lt;br id="zbk:2"&gt;
Things weren't too good to start with. I personally do not favor
any platform for getting certain things done, but the fact of the matter is
that Microsoft excels in product support. If you can find issues with any
product, you are most likely to find remedies over the support site. With
Coherence, and Oracle I am afraid things aren't the way they should. They need
some effort here.&lt;br id="b9xm"&gt;
&lt;br id="b9xm0"&gt;
The issues I faced while implementing the solution are:&lt;br id="b9xm1"&gt;
- Although my .Net class was derived from IPortableObject, I
wasn't able to serialize int!!! There was no issue with strings. The error
message was as generic as it can ever get - Java.Io.IoException: Unable to
convert type -20 to a binary type. If you do a search you will not find
anything helpful.&lt;br id="xqlu"&gt;
- If I tried to use one more class, it failed with the message:
Unable to load type 1002. Please note that its suggested in the documents that
custom user type IDs should be greater that 1000. So, my first type Employee
was 1001, and the second type Contractor was 1002. It failed miserably, and
like earlier found nothing over the Web.&lt;br id="u:sx"&gt;
&lt;br id="u:sx0"&gt;
So, I decided to try something else, knowing the fact that it
needs objects in binary format, I used the following:&lt;br id="mg7g"&gt;
&lt;br id="tdxk"&gt;
- Decorated the class in question with [Serializable] attribute&lt;br id="tdio10"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; [Serializable]&lt;br id="o5uo0"&gt;
&amp;nbsp; public class
Contractor : IPerson,
IPortableObject&lt;br id="tdxk0"&gt;
&lt;br id="b053"&gt;
- Created the object and initialized it with values&lt;br id="pw9:"&gt;
&amp;nbsp;&amp;nbsp; IPerson
contractor = new Contractor();&lt;br id="pw9:0"&gt;
&amp;nbsp; contractor.Name = "ABC";&lt;br id="pw9:1"&gt;
&amp;nbsp; contractor.Address = "Karol Bagh";&lt;br id="pw9:2"&gt;
&amp;nbsp; contractor.DoB = DateTime.Now;&lt;br id="gztk"&gt;
&lt;br id="bvac"&gt;
- Initialized the cache&lt;br id="q79j"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cache
= CacheFactory.GetCache("dist-session-cache");&lt;br id="bvac0"&gt;
&lt;br id="bvac1"&gt;
- Created a binary formatter, a memory stream, serialized the object,
and then inserted the array of bytes in binary format in the Coherence cache.&lt;br id="q79j0"&gt;
&amp;nbsp; BinaryFormatter
binFormat = new BinaryFormatter();&lt;br id="q79j1"&gt;
&amp;nbsp; MemoryStream memStream
= new MemoryStream();&lt;br id="q79j2"&gt;
&amp;nbsp; binFormat.Serialize(memStream, contractor);&lt;br id="q79j3"&gt;
&amp;nbsp; byte[]
array = memStream.ToArray();&lt;br id="q79j4"&gt;
&amp;nbsp; cache.Insert(1, array);&lt;br id="vkcw"&gt;
&lt;br id="vkcw0"&gt;
- To deserilaize, I did the following:&lt;br id="vkcw1"&gt;
&amp;nbsp; byte[]
cachedObject = cache[1] as byte[];&lt;br id="vkcw3"&gt;
&amp;nbsp; MemoryStream memStreamFromCache = new MemoryStream(cachedObject);&lt;br id="vkcw6"&gt;
&amp;nbsp; IPerson p = (IPerson)binFormat.Deserialize(memStreamFromCache);&lt;br id="h6i2"&gt;
&lt;br id="h6i20"&gt;
&lt;br id="h6i21"&gt;
I am sure this is going to be helpful for all those using Coherence
with .Net&lt;br id="mlie0"&gt;
&lt;br id="mlie1"&gt;
See you soon with Splunk.&lt;/p&gt;



&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8711884" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/Enterprise/default.aspx">Enterprise</category></item><item><title>A walk in the park</title><link>http://blogs.msdn.com/sanjeets/archive/2008/05/22/a-walk-in-the-park.aspx</link><pubDate>Thu, 22 May 2008 12:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8531555</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/8531555.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=8531555</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=8531555</wfw:comment><description>&lt;p&gt;I have written some Domain specific blogs. You can find them here:&lt;/p&gt;&lt;p&gt;http://sanjeetsahay.blogspot.com&lt;/p&gt;&lt;p&gt;I will resume my postings on Patterns and Frameworks soon. Till then :)&lt;br&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8531555" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/Personal/default.aspx">Personal</category></item><item><title>Creational - Factory Pattern</title><link>http://blogs.msdn.com/sanjeets/archive/2007/09/02/creational-factory-pattern.aspx</link><pubDate>Sun, 02 Sep 2007 16:22:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4705272</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/4705272.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=4705272</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=4705272</wfw:comment><description>&lt;p&gt;In continuation to my previous post, I am presenting you a sample code that implements Factory Pattern.  &lt;p&gt;The overview:&lt;br&gt;&amp;nbsp;- We are using the Person, Gift and Letter classes as we did in the Abstract Factory Pattern implementation. This is just to show how you can use the same scenario against different patterns.&lt;br&gt;&amp;nbsp;- The abstract Person class is the Creator. Gift and Letter are Products.&lt;br&gt;&amp;nbsp;- The concrete creator classes are Employee and Colleague. The concrete Product classes are: Email, Postal for Letter; Flowers, Perfume for Gift.&lt;br&gt;&amp;nbsp;- The Creator has 2 abstract functions that create Products. the Concrete Classes override them to create different Products.&lt;br&gt;&amp;nbsp;- You can create an Array of Concrete objects for the Creator class.  &lt;p&gt;Takeaways:&lt;br&gt;&amp;nbsp;- This pattern is particularly helpful in designing frameworks.&lt;br&gt;&amp;nbsp;- The Creator relies on its subclasses to define the factory method to return the appropriate ConcreteProduct.&lt;br&gt;&amp;nbsp;- There is no Client class.  &lt;p&gt;The Creator Class:&lt;/p&gt; &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 63.32%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 126px; background-color: #f4f4f4; max-height: 200px"&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Person&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; Gift CreateGift();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; Letter CreateLetter();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The Concrete Classes:&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 63.06%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 218px; background-color: #f4f4f4; max-height: 200px"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Employee: Person&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; Gift CreateGift()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Flowers();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; Letter CreateLetter()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Email();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;     &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Colleague: Person&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; Gift CreateGift()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;             &lt;span style="color: #008000"&gt;//throw new NotImplementedException();&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Perfume();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; Letter CreateLetter()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;             &lt;span style="color: #008000"&gt;//throw new NotImplementedException();&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Postal();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;     }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The Products - Letter and Gift; Concrete Products Email, Postal, Flowers, and Perfume&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 63.22%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 217px; background-color: #f4f4f4; max-height: 200px"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Letter&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Email: Letter&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Email()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;             Console.WriteLine(&lt;span style="color: #006080"&gt;"Email Created"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;     &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Postal: Letter&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Postal()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;             Console.WriteLine(&lt;span style="color: #006080"&gt;"Postal Created"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;     &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Gift&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;     {        &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;     &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Flowers: Gift&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Flowers()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;             Console.WriteLine(&lt;span style="color: #006080"&gt;"Flowers Created"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt;     &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  33:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Perfume: Gift&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  34:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  35:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Perfume()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  36:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  37:&lt;/span&gt;             Console.WriteLine(&lt;span style="color: #006080"&gt;"Perfume Created"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  38:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  39:&lt;/span&gt;     }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The usage from within application:&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 63.6%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 205px; background-color: #f4f4f4; max-height: 200px"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;             Person[] people = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Person[2];&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;             people[0] = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Employee();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;             people[1] = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Colleague();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;             &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt;(Person person &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; people)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;                 Console.WriteLine(person.CreateGift());&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;                 person.CreateLetter();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;             Console.Read();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;         }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Hope it helps. Do write to me in case of any question/suggestions.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4705272" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/Software+Design/default.aspx">Software Design</category></item><item><title>Software Design Patterns - Creational Patterns</title><link>http://blogs.msdn.com/sanjeets/archive/2007/09/02/software-design-patterns-creational-patterns.aspx</link><pubDate>Sun, 02 Sep 2007 15:07:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4704360</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/4704360.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=4704360</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=4704360</wfw:comment><description>&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;This happens to be the first of my articles on Software Design Patterns. I will present some basics followed by implementation of the pattern.&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;These patterns help make a system independent of how its objects are created, composed and represented.&lt;br&gt;A class creational pattern uses inheritance to vary the class that’s instantiated, whereas the object creational pattern will delegate instantiation to another object. &lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;In creational patterns emphasis shifts away from hard coding a fixed set of behaviors towards defining a smaller set of fundamental behaviors that can be composed into any number of more complex ones. Thus object composition becomes more important than class inheritance.&lt;br&gt;Some widely used patterns in this category are: &lt;/font&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&lt;strong&gt;Abstract Factory&lt;/strong&gt;&lt;br&gt;&amp;nbsp;- The main purpose is to create objects for the product class.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;- The break-up of classes involved is as follows:&lt;br&gt;&amp;nbsp; &amp;gt; You need an abstract factory class which acts as a base to some concrete classes.&lt;br&gt;&amp;nbsp; &amp;gt; You need an abstract product/entity class which will act as a base class for some fixed number of concrete product classes.&lt;br&gt;&amp;nbsp; &amp;gt; A client, which always uses the interfaces declared by the abstract factory and product classes.&lt;br&gt;&amp;nbsp; &amp;gt; The factory class is not abstract; it in fact uses the Singleton pattern to create only 1 instance. It is used by the product classes to create new instances.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;- You can use this pattern in the following cases:&lt;br&gt;&amp;nbsp; &amp;gt; A system is independent in terms of how its products are created, composed and represented.&lt;br&gt;&amp;nbsp; &amp;gt; You want to provide a class library of things, and you don’t want to reveal the implementations but interfaces.&lt;br&gt;&amp;nbsp; &amp;gt; The number of products is defined.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;- Advantages:&lt;br&gt;&amp;nbsp; &amp;gt; Concrete classes are isolated. Product class names are isolated in the implementation of the concrete factory.&lt;br&gt;&amp;nbsp; &amp;gt; Product families can be changed easily.&lt;br&gt;&amp;nbsp; &amp;gt; Promotes consistency among products.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;- Disadvantages:&lt;br&gt;&amp;nbsp; &amp;gt; Supporting new kinds of products is difficult. It requires you to change the abstract and concrete factory classes at number of places. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&lt;strong&gt;Factory&lt;/strong&gt;&lt;br&gt;&amp;nbsp;- This pattern defines an interface for creating an object, but let subclasses decide which class to instantiate.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;- The break-up of the classes involved is as follows:&lt;br&gt;&amp;nbsp; &amp;gt; You need a Product and a Creator&lt;br&gt;&amp;nbsp; &amp;gt; Concrete classes for Product and Creator.&lt;br&gt;&amp;nbsp; &amp;gt; Creator relies on its subclasses to define factory method so that it returns an instance of the appropriate Concrete Product.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;- The following happens:&lt;br&gt;&amp;nbsp; &amp;gt; You may create multiple Creator classes, and multiple Product classes.&lt;br&gt;&amp;nbsp; &amp;gt; Each Creator has something like a Create() function that creates one/more Products.&lt;br&gt;&amp;nbsp; &amp;gt; From a client, you create an array of Creator base abstract class. This array can have objects from any of the inherited Creator classes.&lt;br&gt;&amp;nbsp; &amp;gt; The inherited Creator classes then create one/more Products for the client. &lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&lt;strong&gt;Builder&lt;/strong&gt;&lt;br&gt;&amp;nbsp;- This pattern is useful when you want to separate the construction of a complex object from its representation. This enables the same construction process to create different representations.&lt;br&gt;&amp;nbsp;- It involves a &lt;em&gt;Builder&lt;/em&gt; and a &lt;em&gt;Director&lt;/em&gt;.&lt;br&gt;&amp;nbsp;- Use this pattern if:&lt;br&gt;&amp;nbsp; &amp;gt; You need to keep the algorithm of creating a complex object separate from the parts that make it up.&lt;br&gt;&amp;nbsp; &amp;gt; The construction process must allow different representations for the object that’s constructed.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;- The break-up of the classes involved are as follows:&lt;br&gt;&amp;nbsp; &amp;gt; There is an abstract builder class for creating parts of a product object.&lt;br&gt;&amp;nbsp; &amp;gt; You need a Concrete Builder class to construct and assemble parts of the product by implementing Builder.&lt;br&gt;&amp;nbsp; &amp;gt; A Director class that constructs an object by using the Builder.&lt;br&gt;&amp;nbsp; &amp;gt; The Product classes that represent the complex object under construction. They do not require an Abstract base class as their implementations have to be very different.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;- The following happens:&lt;br&gt;&amp;nbsp; &amp;gt; A client creates the Director object and configures it with the desired Builder object.&lt;br&gt;&amp;nbsp; &amp;gt; Director notifies the Builder to build a Product. Builder then adds parts to the Product.&lt;br&gt;&amp;nbsp; &amp;gt; The client retrieves the Product from the builder.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;- Advantages:&lt;br&gt;&amp;nbsp; &amp;gt; Director has no direct interaction with the Product so you can easily change/modify them.&lt;br&gt;&amp;nbsp; &amp;gt; It isolates the code for construction and representation.&lt;br&gt;&amp;nbsp; &amp;gt; This pattern constructs products step by step under Director’s control.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size="2"&gt;&lt;br&gt;&lt;br&gt;&lt;font face="Segoe UI"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4704360" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/Software+Design/default.aspx">Software Design</category></item><item><title>Creational - Abstract factory Pattern</title><link>http://blogs.msdn.com/sanjeets/archive/2007/09/02/creational-abstract-factory-pattern.aspx</link><pubDate>Sun, 02 Sep 2007 14:47:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4704927</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/4704927.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=4704927</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=4704927</wfw:comment><description>&lt;p&gt;In continuation to my previous post, I am presenting you a sample code that implements Abstract Factory Pattern.  &lt;p&gt;The overview:&lt;br&gt;&amp;nbsp;- This implementation contains a factory called Person.&lt;br&gt;&amp;nbsp;- The Product/Entity class is represented by 2 abstract classes called Gift and Letter.&lt;br&gt;&amp;nbsp;- The client class is called Client.&lt;br&gt;&amp;nbsp;- Employee and Colleague inherits from Person.&lt;br&gt;&amp;nbsp;- Email inherits Letter and Flowers inherit Gift.&lt;br&gt;&amp;nbsp;- Client creates/receives an instance of Person class which creates objects for Gift and Letter.  &lt;p&gt;Takeaways:&lt;br&gt;&amp;nbsp;- As discussed earlier, Creational Patterns focus on creating objects of Product.&lt;br&gt;&amp;nbsp;- The complexity of this pattern increases as the number of Product increases. You have to add more virtual functions at the Person(Factory) level. Then override those functions at the Concrete classes of the Factory(eg., Employee, Colleague)  &lt;p&gt;The Person class(Factory), this implementation uses the Singleton pattern with Lazy Initialization to make sure that there is only 1 instance in the application.&lt;/p&gt; &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 68.04%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 192px; background-color: #f4f4f4; max-height: 200px"&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Person&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Static variable of the class to see if its already instantiated&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Person _p;      &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// The virual functions to create a Gift Product&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;virtual&lt;/span&gt; Gift CreateGift()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Flowers();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// The virual functions to create a Letter Product&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;virtual&lt;/span&gt; Letter CreateLetter()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Email();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;         &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// This static method gets you the single instance of this class&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; Person GetInstance()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (_p == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  33:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  34:&lt;/span&gt;                 _p = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Person();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  35:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  36:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _p;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  37:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  38:&lt;/span&gt;         &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  39:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  40:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Constructor with restricted access&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  41:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  42:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; Person(){&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  43:&lt;/span&gt;         }        &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  44:&lt;/span&gt;     }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The Employee Concrete Class:&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 68.02%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 207px; background-color: #f4f4f4; max-height: 200px"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// This is one of the Concrete classes which isolated from the client&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Employee: Person&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Constructor to the class&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Employee():&lt;span style="color: #0000ff"&gt;base&lt;/span&gt;()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;             &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Override the virtual declared in the base class.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// This function creates and returns one of the products - Flowers&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; Gift CreateGift()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Flowers();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Override the virtual declared in the base class.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// This function creates and returns one of the products - Email&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; Letter CreateLetter()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Email();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  33:&lt;/span&gt;     }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The Colleague Concrete Class:&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 68.77%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 207px; background-color: #f4f4f4; max-height: 200px"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// This is one of the Concrete classes which isolated from the client&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Colleague: Person&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Constructor to the class&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Colleague():&lt;span style="color: #0000ff"&gt;base&lt;/span&gt;()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Override the virtual declared in the base class.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// This function creates and returns one of the products - Flowers&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; Gift CreateGift()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Flowers();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// Override the virtual declared in the base class.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// This function creates and returns one of the products - Email&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;         &lt;span style="color: #008000"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; Letter CreateLetter()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Email();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt;     }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The Gift and Letter&amp;nbsp;Abstract Product Classes:&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 69.13%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 209px; background-color: #f4f4f4; max-height: 200px"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// This is the Product type #1&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Gift&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     { &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; _name;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;virtual&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Name&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;             get;set;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;              &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Gift()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;             _name = &lt;span style="color: #006080"&gt;"Gift Constructor"&lt;/span&gt;;        &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         }        &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;     } &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// This is the Product type #2&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Letter&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; _purpose;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;                 &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Letter()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;             _purpose = &lt;span style="color: #006080"&gt;"Letter Constructor"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;virtual&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Purpose&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  33:&lt;/span&gt;             get;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  34:&lt;/span&gt;             set;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  35:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  36:&lt;/span&gt;     }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The Products - Email and Flowers:&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 69.66%; cursor: text; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; height: 204px; background-color: #f4f4f4; max-height: 200px"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// This is product #1 of product type #1&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Flowers: Gift&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Flowers()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;             _name = &lt;span style="color: #006080"&gt;"Flowers Constructor"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;         &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Name&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;             get&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _name;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;             set&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt;                 _name = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  20:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  21:&lt;/span&gt;         }      &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  22:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  23:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  24:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  25:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// This is product #1 of product type #2&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  26:&lt;/span&gt;     &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  27:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Email: Letter&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  28:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  29:&lt;/span&gt;     &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  30:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Email()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  31:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  32:&lt;/span&gt;             _purpose = &lt;span style="color: #006080"&gt;"Email Constructor"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  33:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  34:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Purpose&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  35:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  36:&lt;/span&gt;             get&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  37:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  38:&lt;/span&gt;                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _purpose;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  39:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  40:&lt;/span&gt;             set&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  41:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  42:&lt;/span&gt;                 _purpose = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  43:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  44:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  45:&lt;/span&gt;     }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please write to me if you have any questions/suggestions.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4704927" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/Software+Design/default.aspx">Software Design</category></item><item><title>How To: Use SqlMetal.exe to Create a Class from XML and Database</title><link>http://blogs.msdn.com/sanjeets/archive/2007/06/07/how-to-use-sqlmetal-exe-to-create-a-class-from-xml-and-database.aspx</link><pubDate>Thu, 07 Jun 2007 11:23:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3136020</guid><dc:creator>Sanjeet</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/3136020.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=3136020</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=3136020</wfw:comment><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;If you don't have&amp;nbsp;&lt;a href="http://msdn.microsoft.com/vstudio/express/future/visualcsharp/default.aspx"&gt;Visual C# Codename Orcas Express Edition&lt;/a&gt; installed on your development machine, and you are using Visual Studio 2005 with the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=1E902C21-340C-4D13-9F04-70EB5E3DCEEA&amp;amp;displaylang=en"&gt;LINQ 2006 CTP&lt;/a&gt;, then SqlMetal.exe is something that you must lookout for.  &lt;p&gt;It is the O/R mapper that you must use to create a strongly typed class, and use it with DLinq.  &lt;p&gt;You can find SqlMetal.exe at: &lt;em&gt;&lt;font color="#008000"&gt;%systemdrive%\Program Files\LINQ Preview\Bin&lt;/font&gt;&lt;/em&gt; folder.  &lt;p&gt;Its used as following:  &lt;div&gt;&lt;pre class="csharpcode"&gt;usage: sqlmetal [options] [&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;input&lt;/span&gt; &lt;span class="attr"&gt;file&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;]
options:
  /server:&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;     database server name
  /database:&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;   database catalog on server
  /user:&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;       login user id
  /password:&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;   login password
  /views             extract database views
  /functions         extract database functions
  /sprocs            extract stored procedures
  /xml[:file]        output as xml
  /code[:file]       output as source code
  /map[:file]        generate xml mapping file instead of attributes
  /language:xxx      language for source code (vb,csharp)
  /namespace:&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;  namespace used for source code
  /pluralize         auto-pluralize table names
  /dataAttributes    auto-generate DataObjectField and Precision attributes
  /timeout:&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;seconds&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; timeout value in seconds to use for database commands

examples:
To generate an XML file with extracted SQL metadata
  sqlmetal /server:myserver /database:northwind /xml:mymeta.xml

To generate an XML file with extracted SQL metadata from an .mdf file
  sqlmetal /xml:mymeta.xml mydbfile.mdf

To generate source code from an XML metadata file
  sqlmetal /namespace:nwind /code:nwind.cs /language:csharp mymetal.xml

To generate source code from SQL metadata directly
  sqlmetal /server:myserver /database:northwind /namespace:nwind /code:nwind.cs /language:csharp

&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;To create an XML file from a database like Northwind, I copied the .mdf as suggested by the above help and pasted it to the same folder. I used the following command:&lt;br&gt;&lt;em&gt;&lt;font color="#008000"&gt;sqlmetal /xml:northwind.xml Northwind.mdf&lt;/font&gt;&lt;/em&gt;&lt;br&gt;but it failed with: 
&lt;div&gt;&lt;pre class="csharpcode"&gt;Unhandled Exception: System.Data.SqlClient.SqlException: An error has occurred while establishing a
connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fac
t that under the default settings SQL Server does not allow remote connections. (provider: SQL Netwo
rk Interfaces, error: 26 - Error Locating Server/Instance Specified)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConne
ction)&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;div&gt;I thought its asking for the server name, so I tried this:&lt;br&gt;&lt;em&gt;&lt;font color="#008000"&gt;sqlmetal /xml:northwind.xml /server:myserver Northwind.mdf&lt;/font&gt;&lt;/em&gt;&lt;br&gt;it also failed with the following error: &lt;/div&gt;
&lt;div&gt;&lt;pre class="csharpcode"&gt;Unhandled Exception: System.Data.SqlClient.SqlException: An attempt to attach an auto-named database
 for file Northwind.mdf failed. A database with the same name exists, or specified file cannot be op
ened, or it is located on UNC share.
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConne
ction)&lt;/pre&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;The command that worked is following:&lt;br&gt;&lt;font color="#008000"&gt;&lt;em&gt;sqlmetal /server:myserver /database:Northwind /xml:northwind.xml&lt;/em&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Then I thought of creating a class out of the generated XML. I used the following command and it worked the first time:&lt;br&gt;&lt;em&gt;&lt;font color="#008000"&gt;sqlmetal /code:Northwind.cs /language:csharp Northwind.xml&lt;/font&gt;&lt;/em&gt; 
&lt;p&gt;Creating a class file directly from the database is pretty starightforward, I used the following command:&lt;br&gt;&lt;em&gt;&lt;font color="#008000"&gt;sqlmetal /server:myserver /database:Northwind /code:Northwind.cs /language:csharp&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;u&gt;&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;u&gt;C# IDE Support for Visual Studio 2005/C# 2005 Express&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;While this preliminary IDE support greatly enhances the editing experience when writing C# 3.0 code in VS 2005, the language service and compiler are still very much in an alpha phase. In the event of a compiler error, many more errors may be reported than are actually present. If you see a large number of errors when building C# 3.0 code, fix the top error in the error list first and build after each fix. 
&lt;p&gt;&lt;u&gt;&lt;em&gt;Follow these steps to enable LINQ IDE support for Visual Studio 2005 and Visual C# 2005 Express:&lt;/em&gt; &lt;/u&gt;
&lt;p&gt;First, verify that you are running the release version of Visual Studio 2005 or Visual C# 2005 Express. The language service that will be installed only works with the English version of VS 2005/C# 2005 Express and may cause severe problems if installed on earlier versions. You can verify your version by selecting Help\About in Visual Studio 2005. &lt;br&gt;Shut down any running instances of Visual Studio. &lt;br&gt;Open the \bin folder under the LINQ preview installation directory and run &lt;em&gt;&lt;font color="#008000"&gt;“Install C# IDE Support”&lt;/font&gt;&lt;/em&gt;. &lt;br&gt;Start VS 2005/C# 2005 Express. &lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;u&gt;Follow these steps to restore your original VS 2005/C# 2005 Express language service: &lt;/u&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Shut down any running instances of Visual Studio. &lt;br&gt;Open the \bin folder under the LINQ preview installation directory and run &lt;em&gt;&lt;font color="#008000"&gt;“Uninstall C# IDE Support”&lt;/font&gt;&lt;/em&gt;. &lt;br&gt;Start VS 2005/C# 2005 Express. 
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3136020" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/C_2300_+3.0/default.aspx">C# 3.0</category><category domain="http://blogs.msdn.com/sanjeets/archive/tags/LINQ/default.aspx">LINQ</category></item><item><title>How To: Seemlessly Export Data From Database to XML using LINQ</title><link>http://blogs.msdn.com/sanjeets/archive/2007/06/06/how-to-seemlessly-export-data-from-database-to-xml-using-linq.aspx</link><pubDate>Wed, 06 Jun 2007 14:47:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3115449</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/3115449.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=3115449</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=3115449</wfw:comment><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;While exploring a number of neat features available in the Visual C# Orcas Express Edition, you will see the following:&lt;/p&gt; &lt;p&gt;There is no namespace like DLinq, or XLinq anymore, they are replace with more meaningful&lt;br&gt;System.Data.Linq and&lt;br&gt;System.Xml.Linq &lt;/p&gt; &lt;p&gt;However, the latter appears by default in a console application, System.Data.Linq will be added to the references once the O/R mapper a.k.a .dbml file is added. In the express Edition, you can connect to a .mdf, .mdb, or a .sdf(Sql Server Compact Edition) databases.  &lt;p&gt;After instantiating the DataContext class, you will be able to explore its rich features supported with Intellisence.  &lt;p&gt;Apart from that the XML.Linq namespace has got some neat and intuitive features. My favorite is:&lt;br&gt;&lt;em&gt;System.Xml.Linq.XElement xlinq = new XElement(XName name, object content); &lt;/em&gt; &lt;p&gt;As you would expect from it, any object returning values compatible to IEnumerable is taken care of by the constructor... all by itself.&lt;/p&gt; &lt;div class="csharpcode-wrapper" style="width: 70.19%; height: 210px"&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml.Linq;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; ConsoleApplication1&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;            NorthwindDataContext north = &lt;span class="kwrd"&gt;new&lt;/span&gt; NorthwindDataContext();&lt;/pre&gt;&lt;pre&gt;            &lt;span class="rem"&gt;//sample query, not related to this demo!!&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            var products = from p &lt;span class="kwrd"&gt;in&lt;/span&gt; north.Products&lt;/pre&gt;&lt;pre&gt;                           &lt;span class="kwrd"&gt;where&lt;/span&gt; p.ProductID &amp;gt; 10 &amp;amp;&amp;amp; p.ProductID &amp;lt; 200&lt;/pre&gt;&lt;pre class="alt"&gt;                           select &lt;span class="kwrd"&gt;new&lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;                                      p.ProductName,&lt;/pre&gt;&lt;pre class="alt"&gt;                                      p.UnitPrice&lt;/pre&gt;&lt;pre&gt;                                  };&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="rem"&gt;//the actual thing!!!&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;            System.Xml.Linq.XElement xlinq = &lt;span class="kwrd"&gt;new&lt;/span&gt; XElement(&lt;span class="str"&gt;"Products"&lt;/span&gt;,&lt;/pre&gt;&lt;pre class="alt"&gt;                                             from p &lt;span class="kwrd"&gt;in&lt;/span&gt; north.Products&lt;/pre&gt;&lt;pre&gt;                                             &lt;span class="kwrd"&gt;where&lt;/span&gt; p.ProductName.StartsWith(&lt;span class="str"&gt;"S"&lt;/span&gt;)&lt;/pre&gt;&lt;pre class="alt"&gt;                                             select &lt;span class="kwrd"&gt;new&lt;/span&gt; XElement(&lt;span class="str"&gt;"Product"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; XAttribute(&lt;span class="str"&gt;"UnitPrice"&lt;/span&gt;, p.UnitPrice),&lt;/pre&gt;&lt;pre&gt;                                                    &lt;span class="kwrd"&gt;new&lt;/span&gt; XAttribute(&lt;span class="str"&gt;"QuantityPerUnit"&lt;/span&gt;, p.QuantityPerUnit), &lt;/pre&gt;&lt;pre class="alt"&gt;                                                        &lt;span class="kwrd"&gt;new&lt;/span&gt; XElement(&lt;span class="str"&gt;"ProductName"&lt;/span&gt;, p.ProductName),&lt;/pre&gt;&lt;pre&gt;                                                    &lt;span class="kwrd"&gt;new&lt;/span&gt; XElement(&lt;span class="str"&gt;"SupplierName"&lt;/span&gt;, p.Supplier.CompanyName)&lt;/pre&gt;&lt;pre class="alt"&gt;                                                        )&lt;/pre&gt;&lt;pre&gt;                                             );&lt;/pre&gt;&lt;pre class="alt"&gt;            xlinq.Save(&lt;span class="str"&gt;"NewXML.xml"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;            Console.Write(xlinq);            &lt;/pre&gt;&lt;pre class="alt"&gt;            Console.Read();&lt;/pre&gt;&lt;pre&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;    }    &lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;The output in the (command window) looks like the following:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/HowToSeemlesslyExportDataFromDatabasetoX_42E0/Output-linq%5B3%5D.jpg" atomicselection="true"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="616" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/HowToSeemlesslyExportDataFromDatabasetoX_42E0/Output-linq_thumb%5B1%5D.jpg" width="699" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Check out this space, lots more coming up...&lt;/p&gt;
&lt;p&gt;Microsoft ROCKS!!!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3115449" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/C_2300_+3.0/default.aspx">C# 3.0</category><category domain="http://blogs.msdn.com/sanjeets/archive/tags/LINQ/default.aspx">LINQ</category></item><item><title>LINQ Lists - Anonymous Methods and Lambda Expressions</title><link>http://blogs.msdn.com/sanjeets/archive/2007/06/06/linq-lists-anonymous-methods-and-lambda-expressions.aspx</link><pubDate>Wed, 06 Jun 2007 14:22:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3115088</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/3115088.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=3115088</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=3115088</wfw:comment><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;em&gt;&lt;strong&gt;Year: 2005 A.D.&lt;/strong&gt;&lt;br&gt;&lt;/em&gt;The C# 2.0 specification is released in the month of September. It talks about "new" features. We were introduced with a new "in-line" feature of using delegates. We called it "Anonymous Methods". Needless to say, its named as such because:&lt;br&gt;- Its Anonymous (no method name is given)&lt;br&gt;- Its InLine (How can you call something without a name, makes sense doesn't it?)  &lt;p&gt;&lt;strong&gt;&lt;em&gt;Year: 2006 A.D.&lt;/em&gt;&lt;br&gt;&lt;/strong&gt;The C# 3.0 specification is released in the month of May. It talks about new features. Among a number of path breaking innovative ideas, we have something called "Lambda Expressions". It claims to provide more concise, functional syntax for writing anonymous methods.  &lt;p&gt;Lets checkout the basic syntax of Anonymous Methods:&lt;/p&gt; &lt;div class="csharpcode-wrapper" style="width: 78.7%; height: 210px"&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;delegate&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; D(&lt;span class="kwrd"&gt;int&lt;/span&gt; x); &lt;/pre&gt;&lt;pre&gt;D d1 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt; { }; &lt;span class="rem"&gt;// Ok &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;D d2 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;() { }; &lt;span class="rem"&gt;// Error, signature mismatch &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;D d3 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;long&lt;/span&gt; x) { }; &lt;span class="rem"&gt;// Error, signature mismatch &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;D d4 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt; x) { }; &lt;span class="rem"&gt;// Ok &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;D d5 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt; x) { &lt;span class="kwrd"&gt;return&lt;/span&gt;; }; &lt;span class="rem"&gt;// Ok &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;D d6 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt; x) { &lt;span class="kwrd"&gt;return&lt;/span&gt; x; }; &lt;span class="rem"&gt;// Error, return type mismatch &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;delegate&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; E(&lt;span class="kwrd"&gt;out&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; x); &lt;/pre&gt;&lt;pre class="alt"&gt;E e1 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt; { }; &lt;span class="rem"&gt;// Error, E has an out parameter &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;E e2 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;out&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; x) { x = 1; }; &lt;span class="rem"&gt;// Ok &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;E e3 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;ref&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; x) { x = 1; }; &lt;span class="rem"&gt;// Error, signature mismatch &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;delegate&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; P(&lt;span class="kwrd"&gt;params&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;[] a);&lt;/pre&gt;&lt;pre class="alt"&gt;P p1 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt; { }; &lt;span class="rem"&gt;// Error, end of block reachable &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;P p2 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt; { &lt;span class="kwrd"&gt;return&lt;/span&gt;; }; &lt;span class="rem"&gt;// Error, return type mismatch &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;P p3 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt; { &lt;span class="kwrd"&gt;return&lt;/span&gt; 1; }; &lt;span class="rem"&gt;// Ok &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;P p4 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt; { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"Hello"&lt;/span&gt;; }; &lt;span class="rem"&gt;// Error, return type mismatch &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;P p5 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt;[] a) { &lt;span class="rem"&gt;// Ok &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; a[0]; }; &lt;/pre&gt;&lt;pre class="alt"&gt;P p6 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;params&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;[] a) { &lt;span class="rem"&gt;// Error, params modifier &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; a[0]; }; &lt;/pre&gt;&lt;pre class="alt"&gt;P p7 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt;[] a) { &lt;span class="rem"&gt;// Error, return type mismatch &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (a.Length &amp;gt; 0) &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; a[0]; &lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"Hello"&lt;/span&gt;; &lt;/pre&gt;&lt;pre class="alt"&gt;}; &lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;delegate&lt;/span&gt; &lt;span class="kwrd"&gt;object&lt;/span&gt; Q(&lt;span class="kwrd"&gt;params&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;[] a); &lt;/pre&gt;&lt;pre class="alt"&gt;Q q1 = &lt;span class="kwrd"&gt;delegate&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt;[] a) { &lt;span class="rem"&gt;// Ok &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (a.Length &amp;gt; 0) &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; a[0]; &lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"Hello"&lt;/span&gt;; &lt;/pre&gt;&lt;pre class="alt"&gt;};&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;The best example of an anonymous method is when a delegate is used as an Event Handler:&lt;/p&gt;
&lt;p&gt;Without Anonymous:&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 78.96%; height: 127px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;MyButton.Click += &lt;span class="kwrd"&gt;new&lt;/span&gt; EventHandler(MyButtonClicked);&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; MyButtonClicked(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;&lt;pre class="alt"&gt;{&lt;/pre&gt;&lt;pre&gt;MessageBox.Show(&lt;span class="str"&gt;"Hello World!"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;With Anonymous:&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 79.06%; height: 97px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;MyButton.Click += &lt;span class="kwrd"&gt;delegate&lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;MessageBox.Show(&lt;span class="str"&gt;"Hello World!"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;From the above comparison, you can make out that using InLine Functions, we do not need to:&lt;br&gt;- pass arguments across functions.&lt;br&gt;- you can use the scope level variables easily.&lt;br&gt;But, it has tradeoffs which involve code readability and reusability hassles. As the age old saying goes about InLine Functions: Use it efficiently, as its faster than calling functions but slightly difficult to manage.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;u&gt;&lt;strong&gt;Lambda Expressions&lt;/strong&gt;&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;It is written as a parameter list, followed by the =&amp;gt; (slanted lambda?) token, followed by an expression or a statement block.&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 79.42%; height: 400px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        List&amp;lt;Vehicle&amp;gt; vlist = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Vehicle&amp;gt;&lt;/pre&gt;&lt;pre&gt;                              {&lt;/pre&gt;&lt;pre class="alt"&gt;                                  &lt;span class="kwrd"&gt;new&lt;/span&gt; Vehicle{Make=&lt;span class="str"&gt;"Mercedes"&lt;/span&gt;, Model=&lt;span class="str"&gt;"Benz"&lt;/span&gt;, Mileage=12},&lt;/pre&gt;&lt;pre&gt;                                  &lt;span class="kwrd"&gt;new&lt;/span&gt; Vehicle{Make=&lt;span class="str"&gt;"Renault"&lt;/span&gt;, Model=&lt;span class="str"&gt;"Logan"&lt;/span&gt;, Mileage=15},&lt;/pre&gt;&lt;pre class="alt"&gt;                                  &lt;span class="kwrd"&gt;new&lt;/span&gt; Vehicle{Make=&lt;span class="str"&gt;"Honda"&lt;/span&gt;, Model=&lt;span class="str"&gt;"Accord"&lt;/span&gt;, Mileage=12},&lt;/pre&gt;&lt;pre&gt;                              };&lt;/pre&gt;&lt;pre class="alt"&gt;        IEnumerable&amp;lt;Vehicle&amp;gt; vehicles = vlist.Where(v =&amp;gt; v.Mileage &amp;gt; 10);&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Vehicle v &lt;span class="kwrd"&gt;in&lt;/span&gt; vehicles)&lt;/pre&gt;&lt;pre class="alt"&gt;        {&lt;/pre&gt;&lt;pre&gt;            Console.WriteLine(v.Make);&lt;/pre&gt;&lt;pre class="alt"&gt;            Console.WriteLine(v.Model);&lt;/pre&gt;&lt;pre&gt;            Console.WriteLine(v.Mileage);&lt;/pre&gt;&lt;pre class="alt"&gt;            Console.WriteLine(&lt;span class="str"&gt;"-----------------"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;        Console.Read();&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Vehicle&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Make;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Model;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Mileage;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;In the above example:&lt;br&gt;&lt;em&gt;IEnumerable&amp;lt;Vehicle&amp;gt; vehicles = vlist.Where(v =&amp;gt; v.Mileage &amp;gt; 10);&lt;/em&gt;&lt;/p&gt;&lt;em&gt;
&lt;p&gt;&lt;/em&gt;The Lambda Expression: &lt;br&gt;&lt;em&gt;v =&amp;gt; v.Mileage &amp;gt; 10 &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;replaces: &lt;br&gt;&lt;em&gt;new delegate(Vehicle v){&lt;br&gt;v.Mileage &amp;gt; 10;&lt;br&gt;}&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;It can also be replaced by:&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 79.29%; height: 104px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;IEnumerable&amp;lt;Vehicle&amp;gt; vehicles = from v &lt;span class="kwrd"&gt;in&lt;/span&gt; vlist&lt;/pre&gt;&lt;pre&gt;                                            &lt;span class="kwrd"&gt;where&lt;/span&gt; v.Mileage &amp;gt; 12&lt;/pre&gt;&lt;pre class="alt"&gt;                                            select v;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;Try this: &lt;a href="http://msdn.microsoft.com/msdnmag/issues/07/06/CSharp30/default.aspx"&gt;The Evolution Of LINQ And Its Impact On The Design Of C#&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;These samples were created using: &lt;a href="http://msdn.microsoft.com/vstudio/express/future/visualcsharp/default.aspx"&gt;Microsoft Visual C# Codename "Orcas" Express Edition&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3115088" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/C_2300_+3.0/default.aspx">C# 3.0</category><category domain="http://blogs.msdn.com/sanjeets/archive/tags/LINQ/default.aspx">LINQ</category></item><item><title>The Var Of The Worlds</title><link>http://blogs.msdn.com/sanjeets/archive/2007/06/05/the-var-of-the-worlds.aspx</link><pubDate>Wed, 06 Jun 2007 08:30:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3109843</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/3109843.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=3109843</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=3109843</wfw:comment><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;Hello folks,  &lt;p&gt;This time we will explore LINQ over a series of Posts.  &lt;p&gt;As you must be knowing the age old "var" is back. But, is it the same old var that used to be in VB 6.0 days?  &lt;p&gt;Precisely its not the same it has got a number of new features:&lt;br&gt;- You have to declare and instantiate it at the same line of code. Reason: It is smart enough to understand the assigned data type, and it becomes it.&lt;br&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/TheVarOfTheWorlds_13BC8/var-declare%5B4%5D.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="251" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/TheVarOfTheWorlds_13BC8/var-declare_thumb%5B2%5D.jpg" width="471" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;br&gt;var s = int.MaxValue; // it becomes Int32&lt;br&gt;var s2 = double.MaxValue; // it becomes double&lt;br&gt;var s3 = "The Var Of The Worlds" // string &lt;/p&gt; &lt;p&gt;- You cannot assign multiple data types to it. Any attempt to do so results in a compile time error.&lt;br&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/TheVarOfTheWorlds_13BC8/var-typecast%5B7%5D.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="227" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/TheVarOfTheWorlds_13BC8/var-typecast_thumb%5B5%5D.jpg" width="456" border="0"&gt;&lt;/a&gt;  &lt;p&gt;Code with var:&lt;/p&gt; &lt;div class="csharpcode-wrapper" style="width: 62.08%; height: 210px"&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:&lt;/span&gt;     &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:&lt;/span&gt;         var s = from m &lt;span class="kwrd"&gt;in&lt;/span&gt; &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;).GetMethods()&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:&lt;/span&gt;                 select m.Name;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:&lt;/span&gt;         &lt;span class="kwrd"&gt;foreach&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt; str &lt;span class="kwrd"&gt;in&lt;/span&gt; s)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:&lt;/span&gt;             Console.WriteLine(str);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:&lt;/span&gt;         Console.Read();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;Code without a var:&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 62.16%; height: 231px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:&lt;/span&gt;     &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:&lt;/span&gt;         IEnumerable&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; s  = &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:&lt;/span&gt;             from m &lt;span class="kwrd"&gt;in&lt;/span&gt; &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;).GetMethods()&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:&lt;/span&gt;             select m.Name;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:&lt;/span&gt;         &lt;span class="kwrd"&gt;foreach&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt; str &lt;span class="kwrd"&gt;in&lt;/span&gt; s)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:&lt;/span&gt;             Console.WriteLine(str);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:&lt;/span&gt;         Console.Read();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3109843" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/C_2300_+3.0/default.aspx">C# 3.0</category><category domain="http://blogs.msdn.com/sanjeets/archive/tags/LINQ/default.aspx">LINQ</category></item><item><title>How To: Create an efficient data driven page with Business Objects, GridView, Custom paging, and AJAX</title><link>http://blogs.msdn.com/sanjeets/archive/2007/06/02/how-to-create-an-efficient-data-driven-page-with-business-objects-gridview-custom-paging-and-ajax.aspx</link><pubDate>Sat, 02 Jun 2007 15:53:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3043681</guid><dc:creator>Sanjeet</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/3043681.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=3043681</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=3043681</wfw:comment><description>&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;u&gt;&lt;strong&gt;Preface:&lt;/strong&gt;&lt;/u&gt;&lt;/font&gt;&lt;/p&gt; &lt;div&gt;&lt;font face="Segoe UI" size="2"&gt;I have seen a large number of cases where the customer complaint of performance and scalability issues &lt;br&gt;when they create/manage a data-aware application. That’s when I decided that I should come up with &lt;br&gt;something that is concise, efficient, and easy to implement for developers. &lt;br&gt;Here, is what I created a couple of days ago. &lt;/font&gt;&lt;/div&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;GridView is awesome, and if you combine it with Sql Server 2005, DetailsView and FormView &lt;br&gt;you have a formidable force to build a rich data aware page. You can achieve almost everything &lt;br&gt;that you may require on a page without even writing a single line of code in your ASPX, &lt;br&gt;even Custom paging (it requires you to write some views in TSQL).&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;strong&gt;&lt;u&gt;Requirement Analysis:&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;font face="Segoe UI" size="2"&gt;A simple page for that has to fetch a large amount of data (more than 10K rows) from a remote database.&lt;/font&gt;  &lt;li&gt;&lt;font face="Segoe UI" size="2"&gt;I need paging and&amp;nbsp;sorting support with CRUD on the page&lt;/font&gt;  &lt;li&gt;&lt;font face="Segoe UI" size="2"&gt;I need a way to customize the GridView control&lt;/font&gt;  &lt;li&gt;&lt;font face="Segoe UI" size="2"&gt;I need to use a 3-tier structure where I have Data Access Layer, Business Access Layer, and the Presentation Layer.&lt;/font&gt;  &lt;li&gt;&lt;font face="Segoe UI" size="2"&gt;Everybody is talking and using AJAX, so I need that also. I like the word &lt;em&gt;"Partial-Rendering"&lt;/em&gt; ;)&lt;/font&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;u&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/u&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;You need Visual Studio 2005, Sql Server 2005, and ASP.net AJAX 1.0&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;u&gt;&lt;strong&gt;Architecture:&lt;/strong&gt;&lt;/u&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;strong&gt;&lt;u&gt;The DAL:&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;It is implemented using a Dataset. This is a strongly typed dataset, and contains all the required Stored procedures and queries.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/UsingBusinessObjectsandlargeda.0GridView_2127/xsd2.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="480" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/UsingBusinessObjectsandlargeda.0GridView_2127/xsd_thumb.jpg" width="578" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;We will concentrate on the class "Entity" only.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;The following is the implementation of the BAL.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/UsingBusinessObjectsandlargeda.0GridView_2127/cd12.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="467" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/UsingBusinessObjectsandlargeda.0GridView_2127/cd_thumb8.jpg" width="640" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;The presentation layer has only 1 page for now. I hope this is what we need now. It looks like the following:&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/UsingBusinessObjectsandlargeda.0GridView_2127/UI6.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="509" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/UsingBusinessObjectsandlargeda.0GridView_2127/UI_thumb2.jpg" width="800" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;As we can see, we have highly &lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt;Customized the datagrid. Lets dive deeper into the functionality.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;strong&gt;&lt;u&gt;The BAL:&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;The following code snippet contains Insert, Edit, and Delete functions required to do usual stuff. Its self explanatory.&lt;/font&gt;&lt;/p&gt; &lt;div class="csharpcode-wrapper" style="width: 46.49%; height: 200px"&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// This is the Insert function for the class. &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// It takes all the columns as arguments and uses a DatabaseDirect mode to update the database directly.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="EntityID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="UserID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="Title"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="Description"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Insert(&lt;span class="kwrd"&gt;int&lt;/span&gt; EntityID, &lt;span class="kwrd"&gt;string&lt;/span&gt; UserID, &lt;span class="kwrd"&gt;string&lt;/span&gt; Title, &lt;span class="kwrd"&gt;string&lt;/span&gt; Description)&lt;/pre&gt;&lt;pre class="alt"&gt;{&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; rowsAffected = 0;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//Update the DB directly&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//Insert function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        rowsAffected = ad.Insert(UserID, Title, Description);&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//throw all the error that are catched here&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; rowsAffected;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// This is the Edit function for the class. &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// It takes all the columns as arguments and uses a DatabaseDirect mode to update the database directly.&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="EntityID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="UserID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="Title"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="Description"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Edit(&lt;span class="kwrd"&gt;int&lt;/span&gt; EntityID, &lt;span class="kwrd"&gt;string&lt;/span&gt; UserID, &lt;span class="kwrd"&gt;string&lt;/span&gt; Title, &lt;span class="kwrd"&gt;string&lt;/span&gt; Description)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; rowsAffected = 0;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//Update function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        rowsAffected = ad.Update(UserID, Title, Description, EntityID, EntityID);&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//throw all the error that are catched here&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; rowsAffected;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// This is the Delete function for the class. &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// It takes all the columns as arguments and uses a DatabaseDirect mode to update the database directly.&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="EntityID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Delete(&lt;span class="kwrd"&gt;int&lt;/span&gt; EntityID)&lt;/pre&gt;&lt;pre class="alt"&gt;{&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; rowsAffected = 0;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//Delete function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        rowsAffected = ad.Delete(EntityID);&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//throw all the error that are catched here or apply&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; rowsAffected;&lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Now the Select functions. These functions are the key to our demo. We will explain each of them at a later part in this post.&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 46.59%; height: 177px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// This function selects all the records filtered by UserID&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="UserID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; ManageabilityDS.EntityDataTable Select(&lt;span class="kwrd"&gt;string&lt;/span&gt; UserID)&lt;/pre&gt;&lt;pre class="alt"&gt;{&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//GetEntitiesByUser function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; ad.GetEntitiesByUser(UserID);&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// This function selects all the records filtered by UserID and EntityID&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="UserID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="EntityID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; ManageabilityDS.EntityDataTable Select(&lt;span class="kwrd"&gt;string&lt;/span&gt; UserID, &lt;span class="kwrd"&gt;int&lt;/span&gt; EntityID)&lt;/pre&gt;&lt;pre class="alt"&gt;{&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//GetEntityByUserAndEntityID function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; ad.GetEntityByUserAndEntityID(UserID, EntityID);&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;}   &lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// This function gets the maximum rows from the table after its sequenced using Row_number&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="UserID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;long&lt;/span&gt; GetMaxNumberOfRows(&lt;span class="kwrd"&gt;string&lt;/span&gt; UserID)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;long&lt;/span&gt; num = 0;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//GetNumberOfRows function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        num = (&lt;span class="kwrd"&gt;long&lt;/span&gt;)ad.GetNumberOfRows(UserID);&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; num;&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// This function return a strongly type list containing paged data&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// A benefit of using Generic here is to minimize the size of the object&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="UserID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="StartRowIndex"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="MaximumRows"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Entity&amp;gt; Select(&lt;span class="kwrd"&gt;string&lt;/span&gt; UserID, &lt;span class="kwrd"&gt;int&lt;/span&gt; StartRowIndex, &lt;span class="kwrd"&gt;int&lt;/span&gt; MaximumRows)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    ManageabilityDS.EntityDataTable tbl = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;    List&amp;lt;Entity&amp;gt; t = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Entity&amp;gt;(); &lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//GetPagedEntityByUser function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        tbl = ad.GetPagedEntityByUser(StartRowIndex, MaximumRows, UserID);&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//fill the strongly typed List with data&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (ManageabilityDS.EntityRow row &lt;span class="kwrd"&gt;in&lt;/span&gt; tbl.Rows)&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;            Entity en = &lt;span class="kwrd"&gt;new&lt;/span&gt; Entity();&lt;/pre&gt;&lt;pre&gt;            en.EntityID = row.EntityID;&lt;/pre&gt;&lt;pre class="alt"&gt;            en.UserId = row.UserID;&lt;/pre&gt;&lt;pre&gt;            en.Title = row.Title;&lt;/pre&gt;&lt;pre class="alt"&gt;            en.Description = row.Description;&lt;/pre&gt;&lt;pre&gt;            t.Add(en);&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; t;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// This function return a strongly type list containing paged and sorted data&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="UserID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="StartRowIndex"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="MaximumRows"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="ColumnToOrder"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="OrderDirection"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Entity&amp;gt; Select(&lt;span class="kwrd"&gt;string&lt;/span&gt; UserID, &lt;span class="kwrd"&gt;int&lt;/span&gt; StartRowIndex, &lt;span class="kwrd"&gt;int&lt;/span&gt; MaximumRows, &lt;span class="kwrd"&gt;string&lt;/span&gt; ColumnToOrder, &lt;span class="kwrd"&gt;string&lt;/span&gt; OrderDirection)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    ManageabilityDS.EntityDataTable tbl = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;    List&amp;lt;Entity&amp;gt; t = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Entity&amp;gt;();&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//GetPagedEntityByUserOrdered function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        tbl = ad.GetPagedEntityByUserOrdered(StartRowIndex, MaximumRows, UserID, ColumnToOrder, OrderDirection);&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//fill the strongly typed List with data&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (ManageabilityDS.EntityRow row &lt;span class="kwrd"&gt;in&lt;/span&gt; tbl.Rows)&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;            Entity en = &lt;span class="kwrd"&gt;new&lt;/span&gt; Entity();&lt;/pre&gt;&lt;pre&gt;            en.EntityID = row.EntityID;&lt;/pre&gt;&lt;pre class="alt"&gt;            en.UserId = row.UserID;&lt;/pre&gt;&lt;pre&gt;            en.Title = row.Title;&lt;/pre&gt;&lt;pre class="alt"&gt;            en.Description = row.Description;&lt;/pre&gt;&lt;pre&gt;            t.Add(en);&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; t;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;u&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/u&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;u&gt;&lt;strong&gt;The Presentation Layer:&lt;/strong&gt;&lt;/u&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;The datag&lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt;rid looks like following in code:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 47%; height: 190px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&amp;lt;asp:GridView ID=&lt;span class="str"&gt;"MainGrid"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; EnableViewState=&lt;span class="str"&gt;"true"&lt;/span&gt; AutoGenerateColumns=&lt;span class="str"&gt;"False"&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    CellPadding=&lt;span class="str"&gt;"4"&lt;/span&gt; ForeColor=&lt;span class="str"&gt;"#333333"&lt;/span&gt; Width=&lt;span class="str"&gt;"100%"&lt;/span&gt; PageSize=&lt;span class="str"&gt;"2"&lt;/span&gt; DataKeyNames=&lt;span class="str"&gt;"EntityID"&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    EmptyDataText=&lt;span class="str"&gt;"No data available"&lt;/span&gt; OnRowDeleting=&lt;span class="str"&gt;"MainGrid_RowDeleting"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre&gt;    &amp;lt;FooterStyle BackColor=&lt;span class="str"&gt;"#507CD1"&lt;/span&gt; Font-Bold=&lt;span class="str"&gt;"True"&lt;/span&gt; ForeColor=&lt;span class="str"&gt;"White"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &amp;lt;RowStyle BackColor=&lt;span class="str"&gt;"#EFF3FB"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre&gt;    &amp;lt;EditRowStyle BackColor=&lt;span class="str"&gt;"#2461BF"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &amp;lt;SelectedRowStyle BackColor=&lt;span class="str"&gt;"#D1DDF1"&lt;/span&gt; Font-Bold=&lt;span class="str"&gt;"True"&lt;/span&gt; ForeColor=&lt;span class="str"&gt;"#333333"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre&gt;    &amp;lt;HeaderStyle Font-Bold=&lt;span class="str"&gt;"True"&lt;/span&gt; HorizontalAlign=&lt;span class="str"&gt;"Left"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &amp;lt;AlternatingRowStyle BackColor=&lt;span class="str"&gt;"White"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre&gt;    &amp;lt;Columns&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &amp;lt;asp:TemplateField HeaderText=&lt;span class="str"&gt;"Details"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;HeaderStyle Font-Bold=&lt;span class="str"&gt;"True"&lt;/span&gt; Width=&lt;span class="str"&gt;"80%"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &amp;lt;ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre&gt;                &amp;lt;table width=&lt;span class="str"&gt;"100%"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                    &amp;lt;tr&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;td width=&lt;span class="str"&gt;"15%"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                            &amp;lt;span&amp;gt;&amp;lt;b&amp;gt;ID:&amp;lt;/b&amp;gt;&amp;lt;/span&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;td&amp;gt;&lt;/pre&gt;&lt;pre&gt;                            &amp;lt;asp:Label ID=&lt;span class="str"&gt;"EntityIDLabel"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%#Bind("EntityID")%&amp;gt;'&lt;/span&gt;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre&gt;                    &amp;lt;/tr&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                    &amp;lt;tr&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;td bgcolor=&lt;span class="str"&gt;"silver"&lt;/span&gt; colspan=&lt;span class="str"&gt;"2"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre&gt;                    &amp;lt;/tr&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                    &amp;lt;tr&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;td&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                            &amp;lt;span&amp;gt;&amp;lt;b&amp;gt;Title:&amp;lt;/b&amp;gt;&amp;lt;/span&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;td&amp;gt;&lt;/pre&gt;&lt;pre&gt;                            &amp;lt;asp:Label ID=&lt;span class="str"&gt;"TitleLabel"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%#Bind("Title")%&amp;gt;'&lt;/span&gt;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre&gt;                    &amp;lt;/tr&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                    &amp;lt;tr&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;td bgcolor=&lt;span class="str"&gt;"silver"&lt;/span&gt; colspan=&lt;span class="str"&gt;"2"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre&gt;                    &amp;lt;/tr&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                    &amp;lt;tr&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;td&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                            &amp;lt;span&amp;gt;&amp;lt;b&amp;gt;Description:&amp;lt;/b&amp;gt;&amp;lt;/span&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;td&amp;gt;&lt;/pre&gt;&lt;pre&gt;                            &amp;lt;asp:Label ID=&lt;span class="str"&gt;"DescriptionLabel"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Font-Italic=&lt;span class="str"&gt;"true"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%#Bind("Description")%&amp;gt;'&lt;/span&gt;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre&gt;                    &amp;lt;/tr&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                &amp;lt;/table&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;/ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &amp;lt;/asp:TemplateField&amp;gt;&lt;/pre&gt;&lt;pre&gt;        &amp;lt;asp:TemplateField HeaderText=&lt;span class="str"&gt;"Options"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &amp;lt;ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre&gt;                &amp;lt;table width=&lt;span class="str"&gt;"100%"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                    &amp;lt;tr&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;td valign=&lt;span class="str"&gt;"top"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                            &amp;lt;asp:LinkButton ID=&lt;span class="str"&gt;"Select"&lt;/span&gt; CommandName=&lt;span class="str"&gt;"Select"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;"Select"&lt;/span&gt;&amp;gt;&amp;lt;/asp:LinkButton&amp;gt;&lt;/pre&gt;&lt;pre&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                    &amp;lt;/tr&amp;gt;&lt;/pre&gt;&lt;pre&gt;                    &amp;lt;tr&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;td valign=&lt;span class="str"&gt;"top"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre&gt;                            &amp;lt;asp:LinkButton ID=&lt;span class="str"&gt;"Delete"&lt;/span&gt; CommandName=&lt;span class="str"&gt;"Delete"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;"Delete"&lt;/span&gt; OnClientClick=&lt;span class="str"&gt;"return confirm('Are you sure you want to delete this record?');"&lt;/span&gt;&amp;gt;&amp;lt;/asp:LinkButton&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                        &amp;lt;/td&amp;gt;&lt;/pre&gt;&lt;pre&gt;                    &amp;lt;/tr&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                &amp;lt;/table&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;/ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &amp;lt;HeaderStyle Font-Bold=&lt;span class="str"&gt;"False"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre&gt;        &amp;lt;/asp:TemplateField&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &amp;lt;/Columns&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;lt;/asp:GridView&amp;gt;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;We have made extensive use of template columns to give it a different look. &lt;br&gt;To bind the data we simply used: &lt;em&gt;Text='&amp;lt;%#Bind("Column_Name")%&amp;gt;'&lt;/em&gt; e.g.&lt;br&gt;&lt;em&gt;Text = '&amp;lt;%#Bind("Title")%&amp;gt;'&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Notice that the paging is disabled. DataKeyNames is set to the Primary Key,&lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;br&gt;and we have defined OnRowDeleting event for deleting a record.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Remember those days, when we used to code OnItemDatBound event in &lt;br&gt;ASP.Net 1.1 to bind the Delete button attribute with an OnClick event. Now, &lt;br&gt;its as easy as assigning &lt;em&gt;OnClientClick = [required javascript]&lt;/em&gt; e.g.&lt;br&gt;&lt;em&gt;OnClientClick = "return confirm(Are you sure?)"&lt;/em&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;The DetailsView looks like the following in code:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 46.9%; height: 170px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&amp;lt;asp:DetailsView ID=&lt;span class="str"&gt;"EntityDetailsView"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; AutoGenerateRows=&lt;span class="str"&gt;"False"&lt;/span&gt; DataKeyNames=&lt;span class="str"&gt;"EntityID"&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    DataSourceID=&lt;span class="str"&gt;"odsDetailView"&lt;/span&gt; Height=&lt;span class="str"&gt;"50px"&lt;/span&gt; Width=&lt;span class="str"&gt;"100%"&lt;/span&gt; OnItemInserted=&lt;span class="str"&gt;"EntityDetailsView_ItemInserted"&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    OnItemUpdated=&lt;span class="str"&gt;"EntityDetailsView_ItemUpdated"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre&gt;    &amp;lt;Fields&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &amp;lt;asp:BoundField DataField=&lt;span class="str"&gt;"EntityID"&lt;/span&gt; HeaderText=&lt;span class="str"&gt;"ID:"&lt;/span&gt; InsertVisible=&lt;span class="str"&gt;"False"&lt;/span&gt; ReadOnly=&lt;span class="str"&gt;"True"&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;            SortExpression=&lt;span class="str"&gt;"EntityID"&lt;/span&gt; HeaderStyle-Width=&lt;span class="str"&gt;"15%"&lt;/span&gt; HeaderStyle-Font-Bold=&lt;span class="str"&gt;"true"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &amp;lt;asp:BoundField DataField=&lt;span class="str"&gt;"UserID"&lt;/span&gt; HeaderText=&lt;span class="str"&gt;"UserID"&lt;/span&gt; SortExpression=&lt;span class="str"&gt;"UserID"&lt;/span&gt; Visible=&lt;span class="str"&gt;"False"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre&gt;        &amp;lt;asp:TemplateField HeaderText=&lt;span class="str"&gt;"Title:"&lt;/span&gt; HeaderStyle-VerticalAlign=&lt;span class="str"&gt;"Top"&lt;/span&gt; SortExpression=&lt;span class="str"&gt;"Title"&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            HeaderStyle-Font-Bold=&lt;span class="str"&gt;"true"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;EditItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                &amp;lt;asp:TextBox ID=&lt;span class="str"&gt;"TextBox1"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%# Bind("Title") %&amp;gt;'&lt;/span&gt; CssClass=&lt;span class="str"&gt;"textbox"&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;/EditItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &amp;lt;InsertItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre&gt;                &amp;lt;asp:TextBox ID=&lt;span class="str"&gt;"TextBox1"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%# Bind("Title") %&amp;gt;'&lt;/span&gt; CssClass=&lt;span class="str"&gt;"textbox"&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &amp;lt;/InsertItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                &amp;lt;asp:Label ID=&lt;span class="str"&gt;"Label1"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%# Bind("Title") %&amp;gt;'&lt;/span&gt;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;/ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &amp;lt;/asp:TemplateField&amp;gt;&lt;/pre&gt;&lt;pre&gt;        &amp;lt;asp:TemplateField HeaderText=&lt;span class="str"&gt;"Description:"&lt;/span&gt; HeaderStyle-VerticalAlign=&lt;span class="str"&gt;"Top"&lt;/span&gt; SortExpression=&lt;span class="str"&gt;"Description"&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            HeaderStyle-Font-Bold=&lt;span class="str"&gt;"true"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;EditItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                &amp;lt;asp:TextBox ID=&lt;span class="str"&gt;"TextBox2"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%# Bind("Description") %&amp;gt;'&lt;/span&gt; CssClass=&lt;span class="str"&gt;"textarea"&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;                    TextMode=&lt;span class="str"&gt;"MultiLine"&lt;/span&gt; Rows=&lt;span class="str"&gt;"5"&lt;/span&gt; Width=&lt;span class="str"&gt;"80%"&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &amp;lt;/EditItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;InsertItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                &amp;lt;asp:TextBox ID=&lt;span class="str"&gt;"TextBox2"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%# Bind("Description") %&amp;gt;'&lt;/span&gt; CssClass=&lt;span class="str"&gt;"textarea"&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;                    TextMode=&lt;span class="str"&gt;"MultiLine"&lt;/span&gt; Rows=&lt;span class="str"&gt;"5"&lt;/span&gt; Width=&lt;span class="str"&gt;"80%"&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &amp;lt;/InsertItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                &amp;lt;asp:Label ID=&lt;span class="str"&gt;"Label2"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%# Bind("Description") %&amp;gt;'&lt;/span&gt;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;/pre&gt;&lt;pre&gt;            &amp;lt;/ItemTemplate&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &amp;lt;/asp:TemplateField&amp;gt;&lt;/pre&gt;&lt;pre&gt;        &amp;lt;asp:CommandField ShowEditButton=&lt;span class="str"&gt;"True"&lt;/span&gt; ShowInsertButton=&lt;span class="str"&gt;"True"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &amp;lt;/Fields&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;lt;/asp:DetailsView&amp;gt;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode-wrapper, .csharpcode-wrapper pre {
  background-color: #f4f4f4;
  border: solid 1px gray;
  cursor: text;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  margin: 20px 0px 10px 0px;
  max-height: 200px;
  overflow: auto;
  padding: 4px 4px 4px 4px;
  width: 97.5%;
}
.csharpcode-wrapper pre {
  border-style: none;
  margin: 0px 0px 0px 0px;
  overflow: visible;
  padding: 0px 0px 0px 0px;
}
.csharpcode, .csharpcode pre, .csharpcode .alt {
  background-color: #f4f4f4;
  border-style: none;
  color: black;
  font-family: consolas, 'Courier New', courier, monospace;
  font-size: 8pt;
  line-height: 12pt;
  overflow: visible;
  padding: 0px 0px 0px 0px;
  width: 100%;
}
.csharpcode pre {
  margin: 0em;
}
.csharpcode .alt {
  background-color: white;
}
.csharpcode .asp {
  background-color: #ffff00;
}
.csharpcode .attr {
  color: #ff0000;
}
.csharpcode .html {
  color: #800000;
}
.csharpcode .kwrd {
  color: #0000ff;
}
.csharpcode .lnum {
  color: #606060;
}
.csharpcode .op {
  color: #0000c0;
}
.csharpcode .preproc {
  color: #cc6633;
}
.csharpcode .rem {
  color: #008000;
}
.csharpcode .str {
  color: #006080;
}
&lt;/style&gt;
&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Check out the following: &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;We have set &lt;em&gt;DataKeyField&lt;/em&gt; to the Primary Key and set the datasource ID to &lt;br&gt;an &lt;em&gt;ObjectDataSource&lt;/em&gt; called &lt;em&gt;"odsDetailView"&lt;/em&gt;. It fetches all the data via the&lt;br&gt;Business layer and it doesn't need to go to the DAL. &lt;/font&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;The ObjectDataSource truely helps us to build a 3-tier application. &lt;br&gt;Earlier, in this model the UI layer used to bind directly to the Data layer. &lt;br&gt;This actually used to break the tier, and caused scalability and &lt;br&gt;maintenance hassles. &lt;/font&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;We have &lt;em&gt;OnItemInserted&lt;/em&gt; and &lt;em&gt;OnItemUpdated&lt;/em&gt; events handled to refresh the&lt;br&gt;GridView whenever an update is made using the DetailsView. &lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 47.37%; height: 79px"&gt;&lt;pre class="csharpcode"&gt;&amp;lt;asp:DetailsView ID=&lt;span class="str"&gt;"EntityDetailsView"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; AutoGenerateRows=&lt;span class="str"&gt;"False"&lt;/span&gt; DataKeyNames=&lt;span class="str"&gt;"EntityID"&lt;/span&gt;    
 DataSourceID=&lt;span class="str"&gt;"odsDetailView"&lt;/span&gt; Height=&lt;span class="str"&gt;"50px"&lt;/span&gt; Width=&lt;span class="str"&gt;"100%"&lt;/span&gt; OnItemInserted=&lt;span class="str"&gt;"EntityDetailsView_ItemInserted"&lt;/span&gt;    
 OnItemUpdated=&lt;span class="str"&gt;"EntityDetailsView_ItemUpdated"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;So, whenever you click on the Select button in a row inside the GridView,&lt;br&gt;the &lt;em&gt;ObjectDataSource&lt;/em&gt; retrieves the &lt;em&gt;PrimaryKey&lt;/em&gt; from the &lt;em&gt;SelectedValue&lt;/em&gt; property&lt;br&gt;of the GridView. See the definition of the ASP &lt;em&gt;ControlParameter&lt;/em&gt; below.&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 47.54%; height: 138px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&amp;lt;SelectParameters&amp;gt;&lt;/pre&gt;&lt;pre&gt;    &amp;lt;asp:SessionParameter DefaultValue=&lt;span class="str"&gt;"fareast\sanjeets"&lt;/span&gt; Name=&lt;span class="str"&gt;"UserID"&lt;/span&gt; SessionField=&lt;span class="str"&gt;"UserID"&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        Type=&lt;span class="str"&gt;"String"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre&gt;    &amp;lt;asp:ControlParameter ControlID=&lt;span class="str"&gt;"MainGrid"&lt;/span&gt; Name=&lt;span class="str"&gt;"EntityID"&lt;/span&gt; PropertyName=&lt;span class="str"&gt;"SelectedValue"&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        Type=&lt;span class="str"&gt;"Int32"&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;lt;/SelectParameters&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;So far, we have discussed how the controls interact with each other to give you&lt;br&gt;you a nice clutter free UI for simple operations like Insert, Update, and Delete.&lt;br&gt;Now, lets move on the bigger picture. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;I have entered about 50K rows in the Entities table. &lt;/font&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Fair enough, I need paging now. Talking about normal paging would be painful, &lt;br&gt;so thats ruled out (I hope you understand what does the normal paging will &lt;br&gt;do, it will bring all 50K rows and show you 10 rows... it hurts). &lt;/font&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;GridView alongwith ObjectDataSource brings to CustomPaging, so all you have to do,&lt;br&gt;is to use the magic of Row_Number in Sql Server 2005 to bring sequential rows.&lt;br&gt;But, thats again almost codeless. So, you have lesser control over it? I hope you&lt;br&gt;still remember scalability? right?&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Refer to&amp;nbsp;&lt;a href="http://weblogs.asp.net/scottgu/archive/2006/01/01/434314.aspx"&gt;Paging through lots of data efficiently (and in an Ajax way) with ASP.NET 2.0&lt;/a&gt;&lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt; for more &lt;br&gt;information about how to almost codelessly implement custom paging.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Lets take a look into the 2 Stored Procedures:&lt;br&gt;The first one as the name suggests Selects Paged rows by a given condition.&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 47.47%; height: 143px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;ALTER&lt;/span&gt; &lt;span class="kwrd"&gt;Procedure&lt;/span&gt; [dbo].[SelectPagedEntityByUser]&lt;/pre&gt;&lt;pre&gt;    @StartRowIndex &lt;span class="kwrd"&gt;int&lt;/span&gt;,&lt;/pre&gt;&lt;pre class="alt"&gt;    @MaximumRows &lt;span class="kwrd"&gt;int&lt;/span&gt;,&lt;/pre&gt;&lt;pre&gt;    @UserID &lt;span class="kwrd"&gt;varchar&lt;/span&gt;(50)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;AS&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;Select&lt;/span&gt; EntityID, UserID, Title, [Description]&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;From&lt;/span&gt; AllEntities&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;Where&lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;    SrNum &lt;span class="kwrd"&gt;Between&lt;/span&gt; @StartRowIndex &lt;span class="kwrd"&gt;AND&lt;/span&gt; (@StartRowIndex+@MaximumRows)-1&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;AND&lt;/span&gt; UserID = @UserID&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;It uses the following view:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 47.48%; height: 101px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;ALTER&lt;/span&gt; &lt;span class="kwrd"&gt;View&lt;/span&gt; [dbo].[AllEntities]&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;AS&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;Select&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;    EntityID, UserID, Title, [Description], &lt;/pre&gt;&lt;pre class="alt"&gt;    Row_Number() &lt;span class="kwrd"&gt;Over&lt;/span&gt;(&lt;span class="kwrd"&gt;Order&lt;/span&gt; &lt;span class="kwrd"&gt;By&lt;/span&gt; EntityID) &lt;span class="kwrd"&gt;as&lt;/span&gt; SrNum&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;From&lt;/span&gt; Entity&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;The second one, as the name suggests Selects Paged rows by a given condition with a sort&lt;br&gt;condition:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 47.76%; height: 276px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;ALTER&lt;/span&gt; &lt;span class="kwrd"&gt;Procedure&lt;/span&gt; [dbo].[SelectPagedEntityByUserOrdered]&lt;/pre&gt;&lt;pre&gt;    @StartRowIndex &lt;span class="kwrd"&gt;int&lt;/span&gt;,&lt;/pre&gt;&lt;pre class="alt"&gt;    @MaximumRows &lt;span class="kwrd"&gt;int&lt;/span&gt;,&lt;/pre&gt;&lt;pre&gt;    @UserID &lt;span class="kwrd"&gt;varchar&lt;/span&gt;(50),&lt;/pre&gt;&lt;pre class="alt"&gt;    @ColumnToOrder &lt;span class="kwrd"&gt;varchar&lt;/span&gt;(50),&lt;/pre&gt;&lt;pre&gt;    @OrderDirection &lt;span class="kwrd"&gt;varchar&lt;/span&gt;(10)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;AS&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; @ColumnToOrder &lt;span class="kwrd"&gt;like&lt;/span&gt; &lt;span class="str"&gt;'%ID'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;begin&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; @OrderDirection = &lt;span class="str"&gt;'asc'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;begin&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;Select&lt;/span&gt; EntityID, UserID, Title, [Description]&lt;/pre&gt;&lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;From&lt;/span&gt; (&lt;/pre&gt;&lt;pre&gt;                        &lt;span class="kwrd"&gt;Select&lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;                            EntityID, UserID, Title, [Description], &lt;/pre&gt;&lt;pre&gt;                            Row_Number() &lt;span class="kwrd"&gt;Over&lt;/span&gt;(&lt;span class="kwrd"&gt;Order&lt;/span&gt; &lt;span class="kwrd"&gt;By&lt;/span&gt; EntityID) &lt;span class="kwrd"&gt;as&lt;/span&gt; SrNum&lt;/pre&gt;&lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;From&lt;/span&gt; Entity&lt;/pre&gt;&lt;pre&gt;                    ) &lt;span class="kwrd"&gt;as&lt;/span&gt; temp&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;Where&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;                SrNum &lt;span class="kwrd"&gt;Between&lt;/span&gt; @StartRowIndex &lt;span class="kwrd"&gt;AND&lt;/span&gt; (@StartRowIndex+@MaximumRows)-1&lt;/pre&gt;&lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;AND&lt;/span&gt; UserID = @UserID&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;begin&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;Select&lt;/span&gt; EntityID, UserID, Title, [Description]&lt;/pre&gt;&lt;pre&gt;                &lt;span class="kwrd"&gt;From&lt;/span&gt; (&lt;/pre&gt;&lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;Select&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;                            EntityID, UserID, Title, [Description], &lt;/pre&gt;&lt;pre class="alt"&gt;                            Row_Number() &lt;span class="kwrd"&gt;Over&lt;/span&gt;(&lt;span class="kwrd"&gt;Order&lt;/span&gt; &lt;span class="kwrd"&gt;By&lt;/span&gt; EntityID &lt;span class="kwrd"&gt;DESC&lt;/span&gt;) &lt;span class="kwrd"&gt;as&lt;/span&gt; SrNum&lt;/pre&gt;&lt;pre&gt;                        &lt;span class="kwrd"&gt;From&lt;/span&gt; Entity&lt;/pre&gt;&lt;pre class="alt"&gt;                    ) &lt;span class="kwrd"&gt;as&lt;/span&gt; temp&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;Where&lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;                SrNum &lt;span class="kwrd"&gt;Between&lt;/span&gt; @StartRowIndex &lt;span class="kwrd"&gt;AND&lt;/span&gt; (@StartRowIndex+@MaximumRows)-1&lt;/pre&gt;&lt;pre&gt;                &lt;span class="kwrd"&gt;AND&lt;/span&gt; UserID = @UserID&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; @ColumnToOrder = &lt;span class="str"&gt;'title'&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;begin&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; @OrderDirection = &lt;span class="str"&gt;'asc'&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;begin&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;Select&lt;/span&gt; EntityID, UserID, Title, [Description]&lt;/pre&gt;&lt;pre&gt;                &lt;span class="kwrd"&gt;From&lt;/span&gt; (&lt;/pre&gt;&lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;Select&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;                            EntityID, UserID, Title, [Description], &lt;/pre&gt;&lt;pre class="alt"&gt;                            Row_Number() &lt;span class="kwrd"&gt;Over&lt;/span&gt;(&lt;span class="kwrd"&gt;Order&lt;/span&gt; &lt;span class="kwrd"&gt;By&lt;/span&gt; Title) &lt;span class="kwrd"&gt;as&lt;/span&gt; SrNum&lt;/pre&gt;&lt;pre&gt;                        &lt;span class="kwrd"&gt;From&lt;/span&gt; Entity&lt;/pre&gt;&lt;pre class="alt"&gt;                    ) &lt;span class="kwrd"&gt;as&lt;/span&gt; temp&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;Where&lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;                SrNum &lt;span class="kwrd"&gt;Between&lt;/span&gt; @StartRowIndex &lt;span class="kwrd"&gt;AND&lt;/span&gt; (@StartRowIndex+@MaximumRows)-1&lt;/pre&gt;&lt;pre&gt;                &lt;span class="kwrd"&gt;AND&lt;/span&gt; UserID = @UserID&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;begin&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;Select&lt;/span&gt; EntityID, UserID, Title, [Description]&lt;/pre&gt;&lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;From&lt;/span&gt; (&lt;/pre&gt;&lt;pre&gt;                        &lt;span class="kwrd"&gt;Select&lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;                            EntityID, UserID, Title, [Description], &lt;/pre&gt;&lt;pre&gt;                            Row_Number() &lt;span class="kwrd"&gt;Over&lt;/span&gt;(&lt;span class="kwrd"&gt;Order&lt;/span&gt; &lt;span class="kwrd"&gt;By&lt;/span&gt; Title &lt;span class="kwrd"&gt;DESC&lt;/span&gt;) &lt;span class="kwrd"&gt;as&lt;/span&gt; SrNum&lt;/pre&gt;&lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;From&lt;/span&gt; Entity&lt;/pre&gt;&lt;pre&gt;                    ) &lt;span class="kwrd"&gt;as&lt;/span&gt; temp&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;Where&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;                SrNum &lt;span class="kwrd"&gt;Between&lt;/span&gt; @StartRowIndex &lt;span class="kwrd"&gt;AND&lt;/span&gt; (@StartRowIndex+@MaximumRows)-1&lt;/pre&gt;&lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;AND&lt;/span&gt; UserID = @UserID&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; @ColumnToOrder &lt;span class="kwrd"&gt;like&lt;/span&gt; &lt;span class="str"&gt;'desc%'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;begin&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; @OrderDirection = &lt;span class="str"&gt;'asc'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;begin&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;Select&lt;/span&gt; EntityID, UserID, Title, [Description]&lt;/pre&gt;&lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;From&lt;/span&gt; (&lt;/pre&gt;&lt;pre&gt;                        &lt;span class="kwrd"&gt;Select&lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;                            EntityID, UserID, Title, [Description], &lt;/pre&gt;&lt;pre&gt;                            Row_Number() &lt;span class="kwrd"&gt;Over&lt;/span&gt;(&lt;span class="kwrd"&gt;Order&lt;/span&gt; &lt;span class="kwrd"&gt;By&lt;/span&gt; [Description]) &lt;span class="kwrd"&gt;as&lt;/span&gt; SrNum&lt;/pre&gt;&lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;From&lt;/span&gt; Entity&lt;/pre&gt;&lt;pre&gt;                    ) &lt;span class="kwrd"&gt;as&lt;/span&gt; temp&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;Where&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;                SrNum &lt;span class="kwrd"&gt;Between&lt;/span&gt; @StartRowIndex &lt;span class="kwrd"&gt;AND&lt;/span&gt; (@StartRowIndex+@MaximumRows)-1&lt;/pre&gt;&lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;AND&lt;/span&gt; UserID = @UserID&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt;        &lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;begin&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;Select&lt;/span&gt; EntityID, UserID, Title, [Description]&lt;/pre&gt;&lt;pre&gt;                &lt;span class="kwrd"&gt;From&lt;/span&gt; (&lt;/pre&gt;&lt;pre class="alt"&gt;                        &lt;span class="kwrd"&gt;Select&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;                            EntityID, UserID, Title, [Description], &lt;/pre&gt;&lt;pre class="alt"&gt;                            Row_Number() &lt;span class="kwrd"&gt;Over&lt;/span&gt;(&lt;span class="kwrd"&gt;Order&lt;/span&gt; &lt;span class="kwrd"&gt;By&lt;/span&gt; [Description] &lt;span class="kwrd"&gt;DESC&lt;/span&gt;) &lt;span class="kwrd"&gt;as&lt;/span&gt; SrNum&lt;/pre&gt;&lt;pre&gt;                        &lt;span class="kwrd"&gt;From&lt;/span&gt; Entity&lt;/pre&gt;&lt;pre class="alt"&gt;                    ) &lt;span class="kwrd"&gt;as&lt;/span&gt; temp&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;Where&lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;                SrNum &lt;span class="kwrd"&gt;Between&lt;/span&gt; @StartRowIndex &lt;span class="kwrd"&gt;AND&lt;/span&gt; (@StartRowIndex+@MaximumRows)-1&lt;/pre&gt;&lt;pre&gt;                &lt;span class="kwrd"&gt;AND&lt;/span&gt; UserID = @UserID&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;end&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Their corresponding functions in the BL looks like the following:&lt;br&gt;Notice the use of Generics.&lt;br&gt;For the unsorted:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 48.03%; height: 224px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// This function return a strongly type list containing paged data&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// A benefit of using Generic here is to minimize the size of the object&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="UserID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="StartRowIndex"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="MaximumRows"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Entity&amp;gt; Select(&lt;span class="kwrd"&gt;string&lt;/span&gt; UserID, &lt;span class="kwrd"&gt;int&lt;/span&gt; StartRowIndex, &lt;span class="kwrd"&gt;int&lt;/span&gt; MaximumRows)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    ManageabilityDS.EntityDataTable tbl = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;    List&amp;lt;Entity&amp;gt; t = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Entity&amp;gt;(); &lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//GetPagedEntityByUser function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        tbl = ad.GetPagedEntityByUser(StartRowIndex, MaximumRows, UserID);&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//fill the strongly typed List with data&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (ManageabilityDS.EntityRow row &lt;span class="kwrd"&gt;in&lt;/span&gt; tbl.Rows)&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;            Entity en = &lt;span class="kwrd"&gt;new&lt;/span&gt; Entity();&lt;/pre&gt;&lt;pre&gt;            en.EntityID = row.EntityID;&lt;/pre&gt;&lt;pre class="alt"&gt;            en.UserId = row.UserID;&lt;/pre&gt;&lt;pre&gt;            en.Title = row.Title;&lt;/pre&gt;&lt;pre class="alt"&gt;            en.Description = row.Description;&lt;/pre&gt;&lt;pre&gt;            t.Add(en);&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; t;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;For the sorted:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 48.29%; height: 208px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// This function return a strongly type list containing paged and sorted data&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="UserID"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="StartRowIndex"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="MaximumRows"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="ColumnToOrder"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="OrderDirection"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Entity&amp;gt; Select(&lt;span class="kwrd"&gt;string&lt;/span&gt; UserID, &lt;span class="kwrd"&gt;int&lt;/span&gt; StartRowIndex, &lt;span class="kwrd"&gt;int&lt;/span&gt; MaximumRows, &lt;span class="kwrd"&gt;string&lt;/span&gt; ColumnToOrder, &lt;span class="kwrd"&gt;string&lt;/span&gt; OrderDirection)&lt;/pre&gt;&lt;pre class="alt"&gt;{&lt;/pre&gt;&lt;pre&gt;    ManageabilityDS.EntityDataTable tbl = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;    List&amp;lt;Entity&amp;gt; t = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Entity&amp;gt;();&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        ManageabilityDSTableAdapters.EntityTableAdapter ad = &lt;span class="kwrd"&gt;new&lt;/span&gt; ManageabilityDSTableAdapters.EntityTableAdapter();&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//GetPagedEntityByUserOrdered function is defined in the DataSet&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        tbl = ad.GetPagedEntityByUserOrdered(StartRowIndex, MaximumRows, UserID, ColumnToOrder, OrderDirection);&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//fill the strongly typed List with data&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (ManageabilityDS.EntityRow row &lt;span class="kwrd"&gt;in&lt;/span&gt; tbl.Rows)&lt;/pre&gt;&lt;pre class="alt"&gt;        {&lt;/pre&gt;&lt;pre&gt;            Entity en = &lt;span class="kwrd"&gt;new&lt;/span&gt; Entity();&lt;/pre&gt;&lt;pre class="alt"&gt;            en.EntityID = row.EntityID;&lt;/pre&gt;&lt;pre&gt;            en.UserId = row.UserID;&lt;/pre&gt;&lt;pre class="alt"&gt;            en.Title = row.Title;&lt;/pre&gt;&lt;pre&gt;            en.Description = row.Description;&lt;/pre&gt;&lt;pre class="alt"&gt;            t.Add(en);&lt;/pre&gt;&lt;pre&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; t;&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;throw&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Let's get back to the Presentation Layer. Here, as part of customization we have the&lt;br&gt;GridView inside a table which is sitting inside an asp:UpdatePanel... AJAX effect!!!&lt;br&gt;Simple, sweet and effective. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;We had to create the PageLinks for navigation. The ellipsis and all other links are created&lt;br&gt;on the fly and provides smooth and fast navigation at any point.&lt;br&gt;When you click on the link, only PageSize number of rows are fetched from the database,&lt;br&gt;so practically it doesn't matter if you have 50K or 500K records!!! &lt;/font&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Lets see how the Links are created:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 48.6%; height: 175px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// This sub creates all the links on the page&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; CreateButtons()&lt;/pre&gt;&lt;pre class="alt"&gt;{       &lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; totalRecords = &lt;span class="kwrd"&gt;int&lt;/span&gt;.Parse(RecordCountHdn.Value);&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; pageSize = &lt;span class="kwrd"&gt;int&lt;/span&gt;.Parse(PageSizeHdn.Value);&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="rem"&gt;//calculate the total number of links to be created&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; totalPages = totalRecords % pageSize == 0 ? totalRecords / pageSize : (totalRecords / pageSize) + 1;&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="rem"&gt;//this is for the ellipsis, keeps a track of the previous bunch of links&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; x = &lt;span class="kwrd"&gt;int&lt;/span&gt;.Parse(ViewState[&lt;span class="str"&gt;"PageLinkLastBunchCount"&lt;/span&gt;].ToString());&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="rem"&gt;//its the counter that checks whether all the links are created&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; p = MAX_PAGE_LINKS * (x + 1);&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;/pre&gt;&lt;pre&gt;    &lt;span class="rem"&gt;//The ellipsis linkbutton&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    LinkButton ellipsis = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="rem"&gt;////To AJAXify the linkbuttons you need to have triggers&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    AsyncPostBackTrigger t = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="rem"&gt;//clear any previous links in the placeholder&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    PageLinksPH.Controls.Clear();&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (p &amp;lt; totalPages)&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//if you are on the first bunch of links&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (x == 0)&lt;/pre&gt;&lt;pre class="alt"&gt;        {                &lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = MAX_PAGE_LINKS * x; i &amp;lt; p; i++)&lt;/pre&gt;&lt;pre class="alt"&gt;            {&lt;/pre&gt;&lt;pre&gt;                LinkButton l = &lt;span class="kwrd"&gt;new&lt;/span&gt; LinkButton();&lt;/pre&gt;&lt;pre class="alt"&gt;                l.ID = &lt;span class="str"&gt;"pagelink"&lt;/span&gt;+i;&lt;/pre&gt;&lt;pre&gt;                l.Text = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"{0}"&lt;/span&gt;, i + 1);&lt;/pre&gt;&lt;pre class="alt"&gt;                l.ToolTip = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"{0}+..."&lt;/span&gt;, (i * pageSize) + 1);&lt;/pre&gt;&lt;pre&gt;                l.CommandArgument = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"{0}"&lt;/span&gt;, (i * pageSize) + 1);&lt;/pre&gt;&lt;pre class="alt"&gt;                l.CssClass = &lt;span class="str"&gt;"pagelink"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;                &lt;span class="rem"&gt;//add event handler to each linkbutton&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                l.Click += &lt;span class="kwrd"&gt;new&lt;/span&gt; EventHandler(l_Click);&lt;/pre&gt;&lt;pre&gt;                PageLinksPH.Controls.Add(l);&lt;/pre&gt;&lt;pre class="alt"&gt;                t = &lt;span class="kwrd"&gt;new&lt;/span&gt; AsyncPostBackTrigger();&lt;/pre&gt;&lt;pre&gt;                t.ControlID = l.ID;&lt;/pre&gt;&lt;pre class="alt"&gt;                AjaxPanel.Triggers.Add(t);&lt;/pre&gt;&lt;pre&gt;            }&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis = &lt;span class="kwrd"&gt;new&lt;/span&gt; LinkButton();&lt;/pre&gt;&lt;pre&gt;            ellipsis.ID = &lt;span class="str"&gt;"ellipsisNext"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis.Text = &lt;span class="str"&gt;"&amp;gt;&amp;gt;"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;            ellipsis.ToolTip = &lt;span class="str"&gt;"Next"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis.CommandArgument = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"next"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;            ellipsis.CssClass = &lt;span class="str"&gt;"pagelink"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="rem"&gt;//add event handler to each linkbutton&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;            ellipsis.Click += &lt;span class="kwrd"&gt;new&lt;/span&gt; EventHandler(ellipsis_Click);&lt;/pre&gt;&lt;pre class="alt"&gt;            PageLinksPH.Controls.Add(ellipsis);&lt;/pre&gt;&lt;pre&gt;            t = &lt;span class="kwrd"&gt;new&lt;/span&gt; AsyncPostBackTrigger();&lt;/pre&gt;&lt;pre class="alt"&gt;            t.ControlID = ellipsis.ID;&lt;/pre&gt;&lt;pre&gt;            AjaxPanel.Triggers.Add(t);&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="rem"&gt;//this will show next and the previous ellipsis&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        {&lt;/pre&gt;&lt;pre&gt;            ellipsis = &lt;span class="kwrd"&gt;new&lt;/span&gt; LinkButton();&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis.Text = &lt;span class="str"&gt;"&amp;lt;&amp;lt;"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;            ellipsis.ID = &lt;span class="str"&gt;"ellipsisPrevious"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis.ToolTip = &lt;span class="str"&gt;"Previous"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;            ellipsis.CommandArgument = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"previous"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis.CssClass = &lt;span class="str"&gt;"pagelink"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;            &lt;span class="rem"&gt;//add event handler to each linkbutton&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis.Click += &lt;span class="kwrd"&gt;new&lt;/span&gt; EventHandler(ellipsis_Click);&lt;/pre&gt;&lt;pre&gt;            PageLinksPH.Controls.Add(ellipsis);&lt;/pre&gt;&lt;pre class="alt"&gt;            t = &lt;span class="kwrd"&gt;new&lt;/span&gt; AsyncPostBackTrigger();&lt;/pre&gt;&lt;pre&gt;            t.ControlID = ellipsis.ID;&lt;/pre&gt;&lt;pre class="alt"&gt;            AjaxPanel.Triggers.Add(t);&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = MAX_PAGE_LINKS * x; i &amp;lt; p; i++)&lt;/pre&gt;&lt;pre class="alt"&gt;            {&lt;/pre&gt;&lt;pre&gt;                LinkButton l = &lt;span class="kwrd"&gt;new&lt;/span&gt; LinkButton();&lt;/pre&gt;&lt;pre class="alt"&gt;                l.ID = &lt;span class="str"&gt;"pagelink"&lt;/span&gt; + i;&lt;/pre&gt;&lt;pre&gt;                l.Text = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"{0}"&lt;/span&gt;, i + 1);&lt;/pre&gt;&lt;pre class="alt"&gt;                l.ToolTip = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"{0}+..."&lt;/span&gt;, (i * pageSize) + 1);&lt;/pre&gt;&lt;pre&gt;                l.CommandArgument = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"{0}"&lt;/span&gt;, (i * pageSize) + 1);&lt;/pre&gt;&lt;pre class="alt"&gt;                l.CssClass = &lt;span class="str"&gt;"pagelink"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;                &lt;span class="rem"&gt;//add event handler to each linkbutton&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;                l.Click += &lt;span class="kwrd"&gt;new&lt;/span&gt; EventHandler(l_Click);&lt;/pre&gt;&lt;pre&gt;                PageLinksPH.Controls.Add(l);&lt;/pre&gt;&lt;pre class="alt"&gt;                t = &lt;span class="kwrd"&gt;new&lt;/span&gt; AsyncPostBackTrigger();&lt;/pre&gt;&lt;pre&gt;                t.ControlID = l.ID;&lt;/pre&gt;&lt;pre class="alt"&gt;                AjaxPanel.Triggers.Add(t);&lt;/pre&gt;&lt;pre&gt;            }&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis = &lt;span class="kwrd"&gt;new&lt;/span&gt; LinkButton();&lt;/pre&gt;&lt;pre&gt;            ellipsis.ID = &lt;span class="str"&gt;"ellipsisNext"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis.Text = &lt;span class="str"&gt;"&amp;gt;&amp;gt;"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;            ellipsis.ToolTip = &lt;span class="str"&gt;"Next"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;            ellipsis.CommandArgument = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"next"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;            ellipsis.CssClass = &lt;span class="str"&gt;"pagelink"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="rem"&gt;//add event handler to each linkbutton&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;            ellipsis.Click += &lt;span class="kwrd"&gt;new&lt;/span&gt; EventHandler(ellipsis_Click);&lt;/pre&gt;&lt;pre class="alt"&gt;            PageLinksPH.Controls.Add(ellipsis);&lt;/pre&gt;&lt;pre&gt;            t = &lt;span class="kwrd"&gt;new&lt;/span&gt; AsyncPostBackTrigger();&lt;/pre&gt;&lt;pre class="alt"&gt;            t.ControlID = ellipsis.ID;&lt;/pre&gt;&lt;pre&gt;            AjaxPanel.Triggers.Add(t);&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;pre&gt;    }        &lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Event handler for the ellipsis:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 48.81%; height: 188px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// The ellipsis' event handler. It shows the next/previous bunch of links&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="sender"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="e"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; ellipsis_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;&lt;pre class="alt"&gt;{&lt;/pre&gt;&lt;pre&gt;    &lt;span class="rem"&gt;//throw new Exception("The method or operation is not implemented.");&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    LinkButton l = (LinkButton)sender;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; x = &lt;span class="kwrd"&gt;int&lt;/span&gt;.Parse(ViewState[&lt;span class="str"&gt;"PageLinkLastBunchCount"&lt;/span&gt;].ToString());&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (l.CommandArgument.ToLower().Equals(&lt;span class="str"&gt;"previous"&lt;/span&gt;))&lt;/pre&gt;&lt;pre&gt;    {            &lt;/pre&gt;&lt;pre class="alt"&gt;        x--;&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (l.CommandArgument.ToLower().Equals(&lt;span class="str"&gt;"next"&lt;/span&gt;))&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        x++;        &lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;    ViewState[&lt;span class="str"&gt;"PageLinkLastBunchCount"&lt;/span&gt;] = x;&lt;/pre&gt;&lt;pre&gt;    CreateButtons();&lt;/pre&gt;&lt;pre class="alt"&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Event handler for the links:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper" style="width: 48.73%; height: 158px"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// This handler will send the query to the database fetching the &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// exact number of records only. It also takes care of sorting.&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="sender"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;/// &amp;lt;param name="e"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;void&lt;/span&gt; l_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="rem"&gt;//throw new Exception("The method or operation is not implemented.");&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="rem"&gt;//Response.Write("l_Click");&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        LinkButton l = (LinkButton)sender;&lt;/pre&gt;&lt;pre&gt;        l.CssClass = &lt;span class="str"&gt;"pagelinkSelected"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; startIndex = &lt;span class="kwrd"&gt;int&lt;/span&gt;.Parse(l.CommandArgument);&lt;/pre&gt;&lt;pre&gt;        ViewState[&lt;span class="str"&gt;"PageStartIndex"&lt;/span&gt;] = startIndex;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; pageSize = &lt;span class="kwrd"&gt;int&lt;/span&gt;.Parse(PageSizeHdn.Value);&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;using&lt;/span&gt; (Entity en = &lt;span class="kwrd"&gt;new&lt;/span&gt; Entity())&lt;/pre&gt;&lt;pre class="alt"&gt;        {&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (_isPageSorted)&lt;/pre&gt;&lt;pre class="alt"&gt;            {&lt;/pre&gt;&lt;pre&gt;                MainGrid.DataSource = en.Select(_userID, startIndex, pageSize, ColumnList.SelectedValue.ToString(), OrderDirectionList.SelectedValue.ToString());&lt;/pre&gt;&lt;pre class="alt"&gt;            }&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;            {&lt;/pre&gt;&lt;pre&gt;                MainGrid.DataSource = en.Select(_userID, startIndex, pageSize);&lt;/pre&gt;&lt;pre class="alt"&gt;            }&lt;/pre&gt;&lt;pre&gt;            MainGrid.DataBind();&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;pre&gt;        InfoLabel.Text = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"You are at Page# {0}"&lt;/span&gt;, l.Text);&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;catch&lt;/span&gt;(Exception ex)&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        ErrorLabel.Text = ex.Message;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;After you follow the steps above, I am sure it will be a cake walk for you all to create&lt;br&gt;or maintain any such page. It might appear to be lots of work, but its highly reliable&lt;br&gt;and scalable. No blackboxes!!! &lt;/font&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;So, this brings us to an end of this long post, I sincerely hope it will help you a lot.&lt;/font&gt; 
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;See you soon...&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3043681" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/ajax/default.aspx">ajax</category><category domain="http://blogs.msdn.com/sanjeets/archive/tags/Custom+Paging/default.aspx">Custom Paging</category><category domain="http://blogs.msdn.com/sanjeets/archive/tags/GridView/default.aspx">GridView</category><category domain="http://blogs.msdn.com/sanjeets/archive/tags/Business+Object/default.aspx">Business Object</category><category domain="http://blogs.msdn.com/sanjeets/archive/tags/ObjectDatasource/default.aspx">ObjectDatasource</category></item><item><title>Calling a ASP.Net 2.0 Webservice from an XBAP</title><link>http://blogs.msdn.com/sanjeets/archive/2007/05/02/calling-a-asp-net-2-0-webservice-from-an-xbap.aspx</link><pubDate>Wed, 02 May 2007 23:57:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2380456</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/2380456.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=2380456</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=2380456</wfw:comment><description>&lt;p&gt;&lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;Today, I was trying out a couple of things with WPF. Here is the scenario:&lt;/font&gt;&lt;/div&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;I created a simple XML file called "People.xml". My objective was to use this file as a database for my first data aware XBAP.&lt;/font&gt;&lt;/div&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;I had a lot of problems making it to work. The reason?&lt;/font&gt;&lt;/div&gt; &lt;ul&gt; &lt;li&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;It actually tries to find the file in system32 folder&lt;/font&gt;&lt;/div&gt; &lt;li&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;I couldn't figure out a way to send that file as part of deployment process.&lt;/font&gt;&lt;/div&gt; &lt;li&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;This is actually a bad idea. Having local copies of database? nah...&lt;/font&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p class="csharpcode"&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;The best idea is to have a WebService that acts as your business/data access layer. &lt;br&gt;This actually gives you a centralized database. So, I didn't break my head further and moved ahead implementing &lt;br&gt;the WebService solution. This solution also required a lot of brainstorming and troubleshooting. &lt;br&gt;We always used to get "Trust Not Granted" when we used "This is a Full Trust application".&lt;/font&gt;  &lt;p class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;When we used&amp;nbsp;partial trust, it would fail with "System.Security.SecurityException"&lt;/font&gt;&lt;/p&gt; &lt;p class="csharpcode"&gt;&lt;em&gt;&lt;font color="#ff0000"&gt;Request for the permission on type System.Net.webPermission failed.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/CallingaASP.Net2.0WebservicefromanXBAP_C211/SecurityException2.jpg" atomicselection="true"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="378" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/CallingaASP.Net2.0WebservicefromanXBAP_C211/SecurityException_thumb.jpg" width="747" border="0"&gt;&lt;/a&gt; &lt;/div&gt; &lt;div class="csharpcode"&gt;&amp;nbsp;&lt;/div&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;Problem, problem... never mind... there has to be a solution.&lt;/font&gt;&lt;/div&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;&amp;nbsp;&lt;/font&gt;&lt;/div&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI"&gt;When we used a custom security settings for the ClickOnce deployment we got "Trust Not Granted".&lt;/font&gt;&lt;/div&gt; &lt;div class="csharpcode"&gt;&amp;nbsp;&lt;/div&gt; &lt;div class="csharpcode"&gt;&lt;font face="Segoe UI" size="2"&gt;The resolution to this problem is to install the temporary security certificate that is created by default in the XAML browser application. Its named in the format: &amp;lt;ApplicationMane&amp;gt;_TemporaryKey.pfx&lt;/font&gt;&lt;/div&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;You need to install this certificate at the client machines where the application is supposed to run,&amp;nbsp;under &lt;em&gt;Trusted Root Certificate&lt;/em&gt; and &lt;em&gt;Trusted Publishers&lt;/em&gt; zone.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Once done, you can also use a Full Trust ClickOnce deployment.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Enjoy XBAP.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2380456" width="1" height="1"&gt;</description></item><item><title>There is something about Delegates</title><link>http://blogs.msdn.com/sanjeets/archive/2007/04/23/there-is-something-about-delegates.aspx</link><pubDate>Mon, 23 Apr 2007 23:56:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2250145</guid><dc:creator>Sanjeet</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/2250145.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=2250145</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=2250145</wfw:comment><description>&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;Whenever you might have started reading about Delegates, the first line you read is : "Delegates are function pointers in C#"&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;Now what is a function pointer? and how is it going to make my life any easier?&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;Lets understand &lt;em&gt;function pointers &lt;/em&gt;now.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;Function Pointers&lt;/font&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;In old C++ days, we used pointers. We do not use it anymore in our .Net managed world. Atleast all those people who use the luxary of Visual Studio don't.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;A pointer is declared as:&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;span class="lnum"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;div class="csharpcode-wrapper"&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;1: &lt;span class="kwrd"&gt;int&lt;/span&gt;* p = &amp;amp;x;   &lt;/pre&gt;&lt;pre&gt;2: &lt;span class="rem"&gt;// this actually allocates a block of memory of size 4 bytes&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;3: &lt;span class="rem"&gt;// to store the address in memory of the variable x.   &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;4: &lt;span class="rem"&gt;// I would like to mention that each memory allocation has an address attached to it.   &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;5: &lt;span class="rem"&gt;// even this ponter thing has got an address in memory.    &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;6: &lt;span class="rem"&gt;// So the following line of code is perfectly legal.   &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;7: &lt;span class="kwrd"&gt;int&lt;/span&gt;** p2p = &amp;amp;p;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;font face="Segoe UI"&gt;&lt;/font&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Segoe UI" color="#004040"&gt;The Function pointer is implemented as following in C++&lt;/font&gt;&lt;/pre&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;font face="Courier New"&gt;&lt;span class="lnum"&gt;   &lt;/span&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;span class="rem"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;1: &lt;span class="rem"&gt;// lets create a simple function   &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;2: &lt;span class="kwrd"&gt;int&lt;/span&gt; Add2Numbers(&lt;span class="kwrd"&gt;int&lt;/span&gt; i, &lt;span class="kwrd"&gt;int&lt;/span&gt; j)   &lt;/pre&gt;&lt;pre class="alt"&gt;3: {   &lt;/pre&gt;&lt;pre&gt;4:     &lt;span class="kwrd"&gt;return&lt;/span&gt; i+j;   &lt;/pre&gt;&lt;pre class="alt"&gt;5: }   &lt;/pre&gt;&lt;pre&gt;6: &lt;span class="rem"&gt;// So far so good, no flashy stuff!   &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;7: &lt;span class="rem"&gt;// Now lets call this function   &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;8: &lt;span class="kwrd"&gt;int&lt;/span&gt; x = Add2Numbers(2,5);   &lt;/pre&gt;&lt;pre class="alt"&gt;9: &lt;span class="rem"&gt;// So what, I have been using this since ages.  &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;10: &lt;span class="rem"&gt;// Agreed, try this:  &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;11: &lt;span class="kwrd"&gt;int&lt;/span&gt; (*p2F)(int, int) = &amp;amp;Add2Numbers;  &lt;/pre&gt;&lt;pre&gt;12: &lt;span class="kwrd"&gt;int&lt;/span&gt; x = p2F(2, 5); &lt;span class="rem"&gt;// returns 7  &lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;13: &lt;span class="rem"&gt;// Oops, what was that?  &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;14: &lt;span class="rem"&gt;// Here, p2F is a pointer to the function Add2Numbers.   &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;pre&gt;&lt;font face="Courier New"&gt;&lt;span class="rem"&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Courier New"&gt;&lt;span class="rem"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;&lt;/pre&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;So, whats the point?&lt;/font&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;You have a neater construct to call functions. You can call Add2Numbers, and Sub2Numbers by using other means like a "Switch", based upon user selection. &lt;/font&gt;
&lt;li&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;You are making calls by reference, it is considered faster than calling by value, also you make changes to the same data. You do not make copies, no redundancy issues. Works, doesn't it? &lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;&lt;strong&gt;&lt;u&gt;Delegates in C#&lt;/u&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;You will be glad to know that in our managed world, everything is managed ! Alright.... just trying to be funny.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;An integral part of being managed is to be able to know in advance what you are going to do. It holds good for Delegates also. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;So, unlike C++ where you can assign a pointer with whatever function you wish, we have "invented" Delegates. So, just like you declare an int, or a business object, you need to declare a Delegate. Our runtime now knows what you plan to do. No surprises at runtime please. If you offer surprises, be ready to be surprised by the runtime. You get in return at&amp;nbsp;execution&amp;nbsp;what you throw at it at design time. This is cool stuff, isn't it?&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;I am pretty sure, you now know the whereabouts of what I am talking right now. We use Delegates so that we can call functions/methods based on the requirements of the program in execution. It is defined for all methods/functions that match a given signature. But, you need to provide it with the function/method name. So, the complier still knows your intentions. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;Let me share some features now:&lt;/font&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;They are&amp;nbsp;object oriented, type safe, and secure. &lt;/font&gt;
&lt;li&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;An interesting and useful property of a delegate is that it does not know or care about the class of the object that it references. Any object will do; all that matters is that the method's argument types and return type match the delegate's. &lt;/font&gt;
&lt;li&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;A delegate declaration defines a type that encapsulates a method with a particular set of arguments and return type.&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;Getting bored? Don't worry, let my code do the talking...&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="rem"&gt;/// A separate class that contains delegates and functions&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MyDelClass&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// This delegate can be a pointer to all functions that doesnt have any return value and any args&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;delegate&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; NoReturn_And_NoArgDel();&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// This delegate can be a pointer to all functions that has a return value but no args&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;delegate&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Return_But_NoArgDel();&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// This delegate can be a pointer to all functions that has return value and args also&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;param name="arg"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;delegate&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Return_And_ArgDel(&lt;span class="kwrd"&gt;string&lt;/span&gt; arg);&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// Constructor of the class&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; MyDelClass() { }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// A simple HelloWorld function that doesnt return a value or take any arg&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; HelloWorld()&lt;/pre&gt;&lt;pre class="alt"&gt;        {&lt;/pre&gt;&lt;pre&gt;            Console.WriteLine(&lt;span class="str"&gt;"Hello World"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// A simple HelloWorld function that returns a value but takes no arg&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; HelloWorldReturns()&lt;/pre&gt;&lt;pre&gt;        {&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"Hello World Returns"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// A simple HelloWorld function that returns a value and takes an arg&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; HelloWorldReturns(&lt;span class="kwrd"&gt;string&lt;/span&gt; arg)&lt;/pre&gt;&lt;pre class="alt"&gt;        {&lt;/pre&gt;&lt;pre&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; arg;&lt;/pre&gt;&lt;pre class="alt"&gt;        }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Points to be noticed:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;The signature: &lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;delegate&lt;/span&gt; return_type delegate_name(arg_list)&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;ensures that the runtime knows in advance the type of your delegate. This ensures type safety.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;Delegate is a sealed class. You can't inherit from it. So, its secure.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Segoe UI" color="#004040" size="2"&gt;Now lets&amp;nbsp;see what the&amp;nbsp;entry point function has got for us:&lt;/font&gt;&lt;/p&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//instantiate the class&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;        MyDelClass myDel = &lt;span class="kwrd"&gt;new&lt;/span&gt; MyDelClass();&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//First delegate&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;        MyDelClass.NoReturn_And_NoArgDel delNoReturnNoArg = &lt;span class="kwrd"&gt;new&lt;/span&gt; MyDelClass.NoReturn_And_NoArgDel(myDel.HelloWorld);&lt;/pre&gt;&lt;pre&gt;        delNoReturnNoArg.Invoke();&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;        MyDelClass.Return_And_ArgDel delReturnAndArg = &lt;span class="kwrd"&gt;new&lt;/span&gt; MyDelClass.Return_And_ArgDel(myDel.HelloWorldReturns);&lt;/pre&gt;&lt;pre class="alt"&gt;        Console.WriteLine(delReturnAndArg.Invoke(&lt;span class="str"&gt;"Hello World from function Main()"&lt;/span&gt;));&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;        MyDelClass.Return_But_NoArgDel delReturnButNoArg = &lt;span class="kwrd"&gt;new&lt;/span&gt; MyDelClass.Return_But_NoArgDel(myDel.HelloWorldReturns);&lt;/pre&gt;&lt;pre&gt;        Console.WriteLine(delReturnButNoArg.Invoke());&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;        Console.Read();&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Segoe UI" color="#004040"&gt;A delegate is an attribute of the class not of its instance.&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Segoe UI" color="#004040"&gt;You need to use the Invoke() method of the instance of the delegate to call your methods encapsulated by the delegate synchronously.&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;MyDelClass.NoReturn_And_NoArgDel delNoReturnNoArg = &lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;new&lt;/span&gt; MyDelClass.NoReturn_And_NoArgDel(myDel.HelloWorld);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Segoe UI" color="#004040"&gt;Its possible for your delegates to call more than one function at a time:&lt;/font&gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;MyDelClass.NoReturn_And_NoArgDel delNoReturnNoArg = &lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;new&lt;/span&gt; MyDelClass.NoReturn_And_NoArgDel(myDel.HelloWorld);&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;delNoReturnNoArg += &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;new&lt;/span&gt; MyDelClass.NoReturn_And_NoArgDel(myDel.HelloWorld2);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;font face="Segoe UI" color="#004040"&gt;So, you can have more than one method hooked to a delegate.&lt;/font&gt;&lt;/pre&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre&gt;&lt;span class="rem"&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;div class="csharpcode-wrapper"&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;delegate&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; d(&lt;span class="kwrd"&gt;string&lt;/span&gt; one); &lt;/pre&gt;&lt;pre&gt;d a = &lt;span class="kwrd"&gt;new&lt;/span&gt; d1(FuncOne);&lt;/pre&gt;&lt;pre class="alt"&gt;a.Invoke(&lt;span class="str"&gt;"1"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;d b = &lt;span class="kwrd"&gt;new&lt;/span&gt; d2(FuncOne);&lt;/pre&gt;&lt;pre class="alt"&gt;b.Invoke(&lt;span class="str"&gt;"2"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;d x = a + b;&lt;/pre&gt;&lt;pre class="alt"&gt;x.Invoke(&lt;span class="str"&gt;"3"&lt;/span&gt;); &lt;/pre&gt;&lt;pre&gt;&lt;span class="rem"&gt;// Result: 1233&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; FuncOne(&lt;span class="kwrd"&gt;string&lt;/span&gt; one)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;    Console.Write(one);&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre&gt;&lt;span class="rem"&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2250145" width="1" height="1"&gt;</description></item><item><title>AJAX in a nutshell : It can't get any simpler folks</title><link>http://blogs.msdn.com/sanjeets/archive/2007/04/18/ajax-in-a-nutshell-it-can-t-get-any-simpler-folks.aspx</link><pubDate>Thu, 19 Apr 2007 05:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2184969</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/2184969.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=2184969</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=2184969</wfw:comment><description>&lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;strong&gt;1. Ajax basics&lt;/strong&gt; &lt;/font&gt; &lt;p&gt;&lt;font color="#0080c0"&gt;&lt;font face="Segoe UI" size="2"&gt;- "Asynchronous JavaScript and XML," is a web development technique for creating interactive web applications. The intent is to make web pages feel more &lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt;responsive by exchanging small amounts of data with the server behind the scenes, so that the entire web page does not have to be reloaded each time the user &lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt;requests a change. &lt;/font&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- Ajax uses the following existing technologies.&lt;br&gt;&lt;em&gt;Designing/Styling :&lt;/em&gt; XHTML/HTML, CSS&lt;br&gt;&lt;em&gt;Async/Sync calls to the server :&lt;/em&gt; XMLHttpRequest&lt;br&gt;&lt;em&gt;Data manipulation :&lt;/em&gt; DOM&lt;br&gt;&lt;em&gt;Data&amp;nbsp;Exchange :&lt;/em&gt; XML, Html, Plain Text, JSON&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- Ajax is not a technology in itself, but a term that refers to the use of a group of technologies. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;strong&gt;2. History&lt;/strong&gt; &lt;/font&gt; &lt;p&gt;&lt;font color="#0080c0"&gt;&lt;font face="Segoe UI" size="2"&gt;- Although the term Ajax was coined in 2005, most of the technologies that enable Ajax started a decade earlier with Microsoft's initiatives in developing &lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt;Remote Scripting.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- AJAX was made popular in 2005 by Google (with Google Suggest).&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- Remote Scripting allowed a Java Applet to pull data from the server and then use JavaScript at the client side to manipulate it.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- Microsoft then introduced XMLHttpRequest object in IE5 and used it extensively in OWA and MS Exchange 2000. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;strong&gt;3. Advantages &lt;/strong&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- User Experience&lt;br&gt;- Bandwidth Usage&lt;br&gt;- Separation of Data, format, style and function &lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;strong&gt;4. Disadvantages &lt;/strong&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;em&gt;- Browser Integration&lt;/em&gt;&lt;br&gt;The dynamically created page does not register itself with the browser history engine, so triggering the "Back" function of the users' browser might not &lt;/font&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;bring the desired result.&lt;br&gt;Another issue is that dynamic web page updates make it difficult for a user to bookmark a particular state of the application.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;em&gt;- Response Time&lt;/em&gt;&lt;br&gt;Network Latency or the interval between user request and server response&amp;nbsp;- needs to be considered carefully during Ajax development. ASP.Net Ajax has UpdateProgress to counter this concern.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;em&gt;- Dependency on Javascript&lt;/em&gt;&lt;br&gt;Ajax relies on JavaScript, which may be implemented differently by different browsers or versions of a particular browser. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;strong&gt;5. A quick view of XMLHttpRequest&lt;/strong&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- &lt;/font&gt;&lt;a href="http://blogs.msdn.com/sanjeets/archive/2007/04/11/xmlhttp-step-1.aspx"&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;http://blogs.msdn.com/sanjeets/archive/2007/04/11/xmlhttp-step-1.aspx&lt;/font&gt;&lt;/a&gt;&lt;br&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- &lt;/font&gt;&lt;a href="http://blogs.msdn.com/sanjeets/archive/2007/04/13/xmlhttp-step-2.aspx"&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;http://blogs.msdn.com/sanjeets/archive/2007/04/13/xmlhttp-step-2.aspx&lt;/font&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;strong&gt;6. Ajax Toolkit and CTP &lt;/strong&gt;&lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- You need important&amp;nbsp;&lt;/font&gt;&lt;a href="http://ajax.asp.net/downloads/default.aspx?tabid=47"&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;AJAX Downloads&lt;/font&gt;&lt;/a&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&amp;nbsp;to get started. It contains the AJAX Toolkit and Community Technology Preview controls. &lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- The AJAX Extensions provides you with all the necessary controls like UpdatePanel, UpdateProgress, ScriptManager etc. It also provides you with an ASP.Net AJAX Enabled Website template. It is installed in your Visual Studio 2005. So, all you need to do is to select this template and then rock and roll.&lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- The AJAX Toolkit is a set of controls that greatly enhance the UI and provides easy to use functionality.&lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- The CTP tools provide you an some original and extender controls. This is actually created and supported by the ASP.Net AJAX community.&lt;/font&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- See the&amp;nbsp;&lt;/font&gt;&lt;a href="http://www.asp.net/learn/videos/default.aspx?tabid=63"&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;ASP.Net AJAX videos to do simple things simply&lt;/font&gt;&lt;/a&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;strong&gt;7. Asynchronous communication Layer &lt;/strong&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font color="#0080c0"&gt;&lt;font face="Segoe UI" size="2"&gt;- &lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt;The MS ASP.Net AJAX Asynchronous Communication Layer enables a browser to call a Web Service method on the server using Javascript.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- It exposes APIs that Javascript functions can use in any browser to call Webservice.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- It can invoke ASP.Net page methods.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- It supports a variety of serialization formats like JSON(Javascript Object Notation), string, and XML.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- Generates JavaScript proxies at the client so that methods can be accessed using XMLHttp.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- It provides a default XMLHttpExecutor class that functions as an interface between a client web request and the network. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/AJAXinanutshellItcantgetanysimplerfolks_10FE6/ACSC_Comm11.png" atomicselection="true"&gt;&lt;font color="#0080c0"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="223" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/AJAXinanutshellItcantgetanysimplerfolks_10FE6/ACSC_Comm_thumb7.png" width="456" border="0"&gt;&lt;/font&gt;&lt;/a&gt;&lt;font color="#0080c0"&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- The ASP.Net AJAX Client Asynchronous Communication Layer looks like following. It uses JSON for data exchange&amp;nbsp;by default. Its preferred over SOAP/XML because of it doesn't need to use extensive Javascript to&amp;nbsp;construct requests.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- The proxies are created at the client end. This facilitates XMLHttpRequest object to send requests.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/AJAXinanutshellItcantgetanysimplerfolks_10FE6/ACSC_ClientArch2.png" atomicselection="true"&gt;&lt;font color="#0080c0"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="333" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/AJAXinanutshellItcantgetanysimplerfolks_10FE6/ACSC_ClientArch_thumb.png" width="451" border="0"&gt;&lt;/font&gt;&lt;/a&gt;&lt;font color="#0080c0"&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- The Server Asynchronous Communication Layer looks like following. The Http Handler performs deserialization of JSON/XML request and hands it over to Business classes.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/AJAXinanutshellItcantgetanysimplerfolks_10FE6/ACSC_ServerArch2.png" atomicselection="true"&gt;&lt;font color="#0080c0"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="168" src="http://blogs.msdn.com/blogfiles/sanjeets/WindowsLiveWriter/AJAXinanutshellItcantgetanysimplerfolks_10FE6/ACSC_ServerArch_thumb.png" width="451" border="0"&gt;&lt;/font&gt;&lt;/a&gt;&lt;font color="#0080c0"&gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;&lt;strong&gt;8. ScriptManager&lt;/strong&gt;&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI"&gt;&lt;font color="#0080c0" size="2"&gt;- This guy needs special introduction as it sits on each of your AJAX enabled page.&lt;/font&gt;&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- By default, the&amp;nbsp;ScriptManager control registers the script for the Microsoft AJAX Library&amp;nbsp;with the page. This enables client script to use the type system extensions and to support features such as partial-page rendering and Web-service calls.&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- It enables&amp;nbsp;Client-script functionality of the Microsoft AJAX Library, and any custom script that you want to send to the browser.&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- Partial-page rendering, which enables regions on the page to be independently refreshed without a postback. The UpdatePanel, UpdateProgress and Time controls need it.&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;- JavaScript proxy classes for Web services, which enable you to use client script to access Web services by exposing Web services as strongly typed objects.&lt;/font&gt;  &lt;p&gt;&lt;font color="#0080c0"&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;strong&gt;9. Resources &lt;/strong&gt;&lt;/font&gt;&lt;br&gt;&lt;font face="Segoe UI" size="2"&gt;- &lt;/font&gt;&lt;/font&gt;&lt;a href="http://en.wikipedia.org/wiki/AJAX"&gt;&lt;font face="Segoe UI" color="#0080c0" size="2"&gt;http://en.wikipedia.org/wiki/AJAX&lt;/font&gt;&lt;/a&gt;&lt;br&gt;&lt;font face="Segoe UI" size="2"&gt;&lt;font color="#0080c0"&gt;- &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/aboutxmlhttp.asp"&gt;&lt;font color="#0080c0"&gt;http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/aboutxmlhttp.asp&lt;/font&gt;&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2184969" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/ajax/default.aspx">ajax</category></item><item><title>There's something about Async - 1</title><link>http://blogs.msdn.com/sanjeets/archive/2007/04/13/there-s-something-about-async-1.aspx</link><pubDate>Sat, 14 Apr 2007 04:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2123852</guid><dc:creator>Sanjeet</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/2123852.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=2123852</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=2123852</wfw:comment><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;u&gt;&lt;font face="Segoe UI" color="#008000" size="3"&gt;An overview of Asynchronous-ness:&lt;/font&gt;&lt;/u&gt;  &lt;p&gt;&lt;font face="Segoe UI" color="#ff8000" size="2"&gt;&lt;u&gt;&lt;em&gt;Getting started&lt;/em&gt;&lt;/u&gt;&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;You must have read in a number of blogs/articles that asynchronous operations are good for your UI responsiveness. It sounds good too. But, for last many months I have been working hard to put them in place so that I can actually understand and use them. Finally, I did manage to understand.&lt;/font&gt;  &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;You are lucky to be reading this, as I will give you what most articles fail to deliver - simplicity. Too much information is not good. So, let's live one concept at a time. We will try to keep it short and direct. So, let's rock and roll.&lt;/font&gt;  &lt;p&gt;&lt;u&gt;&lt;font face="Segoe UI" color="#ff8000" size="2"&gt;&lt;em&gt;Checklist:&lt;/em&gt;&lt;/font&gt;&lt;/u&gt;  &lt;p&gt;&lt;font face="Segoe UI" size="2"&gt;Before we start to cook anything, we need the ingredients. Here are they:&lt;/font&gt;  &lt;ul&gt; &lt;li&gt;&lt;font face="Segoe UI" size="2"&gt;Delegates :&amp;nbsp;&lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt;Don't worry they are not so scary.&lt;/font&gt;  &lt;li&gt;&lt;font face="Segoe UI" size="2"&gt;Threads and threading :&lt;/font&gt;&lt;font face="Segoe UI" size="2"&gt; I know these are a little complicated stuff, but you need to understand them. You can count on me; I will not make hot gravy.&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2123852" width="1" height="1"&gt;</description></item><item><title>XMLHttp : Step 2</title><link>http://blogs.msdn.com/sanjeets/archive/2007/04/13/xmlhttp-step-2.aspx</link><pubDate>Sat, 14 Apr 2007 04:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2123359</guid><dc:creator>Sanjeet</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/sanjeets/comments/2123359.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sanjeets/commentrss.aspx?PostID=2123359</wfw:commentRss><wfw:comment>http://blogs.msdn.com/sanjeets/rsscomments.aspx?PostID=2123359</wfw:comment><description>&lt;p&gt;&lt;font face="Segoe UI" color="#804000"&gt;&lt;u&gt;How to call Webserver methods using Javascript&lt;/u&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;u&gt;&lt;font face="Segoe UI" color="#804000"&gt;&lt;/font&gt;&lt;/u&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;font face="Segoe UI" color="#004080"&gt;If you are planning to call your own ASP.Net webservice from client side using XMLHttp you need to configure its web.config.&lt;/font&gt;&lt;/p&gt; &lt;p backgroundcolor="beige"&gt;&lt;font color="#004080"&gt;Add the following inside &amp;lt;system.web&amp;gt;:&lt;/font&gt; &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font face="Lucida Console" color="#0000ff" size="2"&gt;&amp;lt;webservices&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;protocols&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name="HttpPost"&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name="HttpGet"&amp;gt;&lt;br&gt;&amp;nbsp; &amp;lt;/protocols&amp;gt;&lt;br&gt;&amp;lt;/webservices&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;font color="#004080"&gt;Paste&amp;nbsp;the following in your htm page. This, however, requires you to fine tune according to your setup. I am using the default namespaces for the XML SOAP header, and my webservice resides on one of my servers.&lt;/font&gt;&lt;br&gt;&lt;/p&gt; &lt;table cellspacing="2" cellpadding="2" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&amp;lt;html&amp;gt;&lt;br&gt;&amp;lt;head&amp;gt;&lt;br&gt;&amp;lt;script language="javascript"&amp;gt; &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//Instantiated an XMLHTTP object.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;var xmlRequest = new ActiveXObject("MSXML2.XMLHTTP"); &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//The following is the event handler for the object.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;function OnComplete()&lt;br&gt;{&lt;br&gt;var spn = document.getElementById("ContentSpan");&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//object.readyState gives us the current status of the async operation. The meaning of status code is printed on the page using the innerHTML property of span. e.g. readyState value 1 corresponds to an open connection.&lt;/font&gt;&lt;/p&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;/font&gt;&lt;font face="Lucida Console" size="2"&gt; &lt;p&gt;&lt;br&gt;switch(xmlRequest.readyState){&lt;br&gt;case 1:&lt;br&gt;spn.innerHTML = "connection opened."&lt;br&gt;break;&lt;br&gt;case 2:&lt;br&gt;spn.innerHTML += "&amp;lt;br&amp;gt;POST request sent."&lt;br&gt;break;&lt;br&gt;case 3:&lt;br&gt;spn.innerHTML += "&amp;lt;br&amp;gt;recieving data...&amp;lt;br&amp;gt;"&lt;br&gt;break;&lt;br&gt;case 4:&lt;br&gt;var responseXML = xmlRequest.responseText;&lt;br&gt;spn.innerHTML += responseXML;&lt;br&gt;alert("Length of response = " + responseXML.length); &lt;br&gt;spn.innerHTML += "&amp;lt;br&amp;gt;complete."&lt;br&gt;break;&lt;br&gt;}&lt;br&gt;} &lt;/p&gt; &lt;p&gt;&lt;/font&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//The following is actually the handling the onClick event for the button.&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;function Invoke_Click()&lt;br&gt;{ &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//The following creates a SOAP header for the request.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;&lt;/font&gt;&lt;font face="Lucida Console" size="2"&gt; &lt;p&gt;&lt;br&gt;var soapEnvelope = "&amp;lt;soap:Envelope xmlns:xsi=\"&lt;/font&gt;&lt;a href="http://www.w3.org/2001/XMLSchema-instance\&amp;quot;&amp;quot;;"&gt;&lt;font face="Lucida Console" size="2"&gt;http://www.w3.org/2001/XMLSchema-instance\""&lt;/font&gt;&lt;/a&gt;&lt;br&gt;&lt;font face="Lucida Console" size="2"&gt;soapEnvelope += " xmlns:xsd=\"&lt;/font&gt;&lt;a href="http://www.w3.org/2001/XMLSchema\&amp;quot;&amp;quot;;"&gt;&lt;font face="Lucida Console" size="2"&gt;http://www.w3.org/2001/XMLSchema\""&lt;/font&gt;&lt;/a&gt;&lt;br&gt;&lt;font face="Lucida Console" size="2"&gt;soapEnvelope += " xmlns:soap=\"&lt;/font&gt;&lt;a href="http://schemas.xmlsoap.org/soap/envelope/\&amp;quot;"&gt;&lt;font face="Lucida Console" size="2"&gt;http://schemas.xmlsoap.org/soap/envelope/\"&lt;/font&gt;&lt;/a&gt;&lt;font face="Lucida Console" size="2"&gt;&amp;gt;"&lt;br&gt;soapEnvelope += "&amp;lt;soap:Body&amp;gt;"&lt;br&gt;soapEnvelope += " &amp;lt;About xmlns=\"&lt;/font&gt;&lt;a href="http://tempuri.org/\&amp;quot;"&gt;&lt;font face="Lucida Console" size="2"&gt;http://tempuri.org/\"&lt;/font&gt;&lt;/a&gt;&lt;font face="Lucida Console" size="2"&gt; /&amp;gt;"&lt;br&gt;soapEnvelope += "&amp;lt;/soap:Body&amp;gt;"&lt;br&gt;soapEnvelope += "&amp;lt;/soap:Envelope&amp;gt;"&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//Assign OnComplete handler to onreadystatechanged. This handler asynchronously gives the status of the response.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;&lt;/font&gt;&lt;font face="Lucida Console" size="2"&gt; &lt;p&gt;&lt;br&gt;xmlRequest.onreadystatechange = OnComplete;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//Open the connection, send a POST request to the Webservice. The "true" parameter marks that an async request is sent.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;br&gt;xmlRequest.open("POST", "&lt;/font&gt;&lt;a href="http://sanjeets-2k3/LogParserWS/LogParserService.asmx/HelloWorld&amp;quot;"&gt;&lt;font face="Lucida Console" size="2"&gt;http://sanjeets-2k3/LogParserWS/LogParserService.asmx/HelloWorld"&lt;/font&gt;&lt;/a&gt;&lt;font face="Lucida Console" size="2"&gt;, true);&lt;br&gt;try{&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//The Content-Type needs to be set to text/xml&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;&lt;/font&gt;&lt;font face="Lucida Console" size="2"&gt; &lt;p&gt;&lt;br&gt;xmlRequest.setRequestHeader("Content-Type", "text/xml");&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//Use the send method to send the request. You can also add the request header that we created above. Although its optional.&lt;/font&gt;&lt;/font&gt;&lt;br&gt;xmlRequest.send(soapEnvelope);&lt;br&gt;}&lt;br&gt;catch(e){&lt;br&gt;alert(e.message);&lt;br&gt;} &lt;br&gt;} &lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&amp;lt;/script&amp;gt; &lt;/font&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&amp;lt;/head&amp;gt;&lt;br&gt;&amp;lt;body&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//A simple HTML button.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&amp;lt;input type="button" id="InvokeButton" value="Invoke" onclick="Invoke_Click();" /&amp;gt;&lt;br&gt;&amp;lt;br /&amp;gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;//A span to write the response HTML.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Lucida Console" color="#8000ff" size="2"&gt;&lt;/font&gt;&lt;font face="Lucida Console" size="2"&gt;&lt;br&gt;&amp;lt;span id="ContentSpan"&amp;gt;&amp;lt;/span&amp;gt;&lt;br&gt;&amp;lt;/body&amp;gt;&lt;br&gt;&amp;lt;/html&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2123359" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sanjeets/archive/tags/xmlhttprequest/default.aspx">xmlhttprequest</category><category domain="http://blogs.msdn.com/sanjeets/archive/tags/xmlhttp/default.aspx">xmlhttp</category></item></channel></rss>