<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-11841833</id><updated>2011-11-27T16:50:33.107-08:00</updated><category term='Microsoft News'/><category term='Microsoft Gadgets'/><category term='WCF'/><category term='.NET Compact Framework'/><category term='HTML'/><category term='SQL Server'/><category term='.NET (Web-Services)'/><category term='My Exam Scores'/><category term='WPF'/><category term='Design Patterns'/><category term='Google News'/><category term='.NET (COM+)'/><category term='.NET'/><category term='ASP.NET'/><title type='text'>Microsoft Technologies</title><subtitle type='html'>Techno Space for Microsoft, .Net Frameworks, SQL Server, C#, Javascript, XML, AJAX, Microsoft .net happenings , Linq, WCF, WF, WPF, Microsoft Gadgets  and lots more.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kaushalp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>75</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-11841833.post-4306745829186855698</id><published>2010-03-26T10:34:00.000-07:00</published><updated>2010-03-26T11:58:17.466-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Threading and Perception</title><content type='html'>&lt;span class="Apple-style-span" style="border-collapse: collapse;font-family:arial,sans-serif;font-size:small;"  &gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Today I thought to tell you something on one of the most complex part of .NET Framework I.e. Threading. I was discussing some of the issues with one of our team member on threading today;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:small;"  &gt; from taking inspiration on that conversion; here are the facts of .NET Threading....&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;.NET Thread object is "&lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;ACTUALLY&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;" not created by .NET; its Operating level thread we are just getting a decorated version of that thread&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;. When we talk about Thread; we must remember the thread pool. The thread pool is just a wrapper class of OS Level thread pool which is optimized for faster allocating/deal locating the memory and thread data. While taking back used thread from user application the same class is also responsible to cleared off the data. This is the internal operation; as a user we don't need to care about it.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:small;"  &gt;The second fact is: some of the blogs (NOT MSDN) mentioned that when you write the code something like:&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 255);font-family:verdana;font-size:small;"  &gt;Thread t = new Thread(DoSomething);&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 255);font-family:verdana;" &gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Its actually not a part of ThreadPool and its creating new thread; which may be right in a way. But this is not the fully truth. If we believe on the blog for an instance; we may not get duplicate thread ever. Now here i am no going in depth of Allocation thread memory, execution etc. but let me tell you one point; even if you write above statement in .NET; it  serves the thread object from Pool only. I know you will not believe this fact.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;I have created an &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;a href="http://cid-50e44036e49794b4.skydrive.live.com/self.aspx/Public/Tech-Updates/ConsoleApplication3.zip.rename"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;example&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; which works on above assumption have a look once.. its interesting to see. I am creating thread using above code and some times i am getting new thread (Displayed in White Font) and some times i get duplicate thread (Displayed in Yellow Font). It proves that internally .NET is keeping a pool of thread.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:small;"  &gt;The second point; In example;I have also set some data on fresh thread each time. Which I am trying to recover when I get the duplicate thread object. And look at the result; The Thread Slot is still there; but .NET erased the data.&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:small;"  &gt;In summery you can say that:&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:small;"  &gt;1. Thread object never created/destroyed from .NET Managed Env. user always gets the thread object from pool only.&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;2. The data you associates with thread (In terms of &lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Thread Slots&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;and ThreadStatic&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;  variables) are &lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;em&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;not persisted on the thread when .NET collects the unused thread for pooling.&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;strong&gt;&lt;em&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style=";font-family:verdana;font-size:small;"  &gt;When Thread Slots are getting cleared off; there is no question to persist the value of ThreadStatic variables.&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Now talking about WCF execution; like this example when you open the WCF Service Channel/Port; it takes one of the available thread from same pool and starts the execution of the code using the thread. You can never get the older data associated with associated with thread earlier. So its perfectly safe to use &lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;ThreadStatic&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; variables.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;This was about console application; lets take ASP.NET application in consideration. .NET takes thread from ThreadPool to execute the request. This thread is persisted in ThreadPool even though the values of ThreadStatic variables are not getting persisted.&lt;br /&gt;&lt;br /&gt;Check-out my &lt;a style="font-weight: bold;" href="http://cid-50e44036e49794b4.skydrive.live.com/self.aspx/Public/Tech-Updates/ASP%20Thread.rar"&gt;ASP.NET example&lt;/a&gt; and observe thread static behavior in PageLoad method.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In short; make the best use of ThreadStatic without any fear.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span&gt;&lt;span style="font-family:Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-4306745829186855698?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/4306745829186855698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/4306745829186855698'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2010/03/threading-and-perception.html' title='Threading and Perception'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-5273376226287138921</id><published>2010-03-25T00:08:00.000-07:00</published><updated>2010-03-25T00:09:03.618-07:00</updated><title type='text'>Google says Good Bye to China</title><content type='html'>&lt;span class="z19Dle" id="col-z12verwbasfex1urq04cdjriqrmqdnbibic"&gt;&lt;span class="zo"&gt;Google has executed its first step towards closer of their China  Operations (Google Search, Google News and Google Images mainly).  &lt;br&gt; &lt;br&gt;Users visiting Google.cn are now being redirected to &lt;a href="http://google.com.hk/" class="ot-anchor"&gt;Google.com.hk&lt;/a&gt;, where  google offers uncensored search in simplified Chinese, specifically  designed for users in mainland China and delivered via our servers in  Hong Kong. &lt;br&gt;  &lt;br&gt;&lt;b&gt;Google.cn&lt;/b&gt; is now &lt;b&gt;&lt;a href="http://google.com.hk/" class="ot-anchor"&gt;Google.com.hk&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;font face="verdana,sans-serif"&gt;&lt;br clear="all"&gt;&lt;/font&gt;--&lt;br&gt;Kaushal Patel&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-5273376226287138921?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/5273376226287138921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/5273376226287138921'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2010/03/google-says-good-bye-to-china.html' title='Google says Good Bye to China'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-4093765557920499220</id><published>2010-03-09T22:11:00.001-08:00</published><updated>2010-03-12T02:33:41.123-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Playing with Generic List</title><content type='html'>&lt;span style="font-family:verdana,sans-serif;"&gt;Generic List a new feature provided by .NET 2.0 and above which can be declared as follow:&lt;/span&gt;    &lt;b style="color: rgb(102, 51, 255); font-family: verdana,sans-serif;"&gt;List&amp;lt;string&amp;gt; lstString = new List&amp;lt;string&amp;gt;();&lt;/b&gt;&lt;br /&gt;&lt;b  style="font-family:verdana,sans-serif;"&gt;Creating Generic Object using &lt;u&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;Reflection&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt; &lt;span style="font-family:verdana,sans-serif;"&gt;Now; there is nothing now in this. And we all know that the generics are type safe. That means you can not pass Child object's referece (Without type casting) where the base class is expected. In case if you need to create Generic List object dynamically depending upon your business scenarios you can use Reflection API to create generic object.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Lets see how to do this:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {margin:0in;  margin-bottom:.0001pt;  font-size:12.0pt;  font-family:"Times New Roman";} a:link, span.MsoHyperlink  {color:blue;  text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed  {color:purple;  text-decoration:underline;} span.EmailStyle17  {mso-style-type:personal-compose;  font-family:Arial;  color:windowtext;} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;div class="Section1"&gt; &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Courier New;font-size:85%;color:blue;"   &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;color:blue;"   &gt;public&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt; &lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;object&lt;/span&gt;&lt;/span&gt; CreateGenericObject(&lt;span style="color:teal;"&gt;&lt;span style="color:teal;"&gt;Type&lt;/span&gt;&lt;/span&gt; genericType, &lt;span style="color:teal;"&gt;&lt;span style="color:teal;"&gt;Type&lt;/span&gt;&lt;/span&gt; innerType, &lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;params&lt;/span&gt;&lt;/span&gt; &lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;object&lt;/span&gt;&lt;/span&gt;[] args)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;{&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;    System.&lt;span style="color:teal;"&gt;&lt;span style="color:teal;"&gt;Type&lt;/span&gt;&lt;/span&gt; speType =  genericType.MakeGenericType(&lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;new&lt;/span&gt;&lt;/span&gt; System.&lt;span style="color:teal;"&gt;&lt;span style="color:teal;"&gt;Type&lt;/span&gt;&lt;/span&gt;[] { innerType  });&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;    &lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="color:teal;"&gt;&lt;span style="color:teal;"&gt;Activator&lt;/span&gt;&lt;/span&gt;.CreateInstance(speType,  args);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;}&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="font-family:verdana,sans-serif;"&gt;  &lt;span style="font-size:85%;"&gt;And your client code would be as follows:&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;&lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;object&lt;/span&gt;&lt;/span&gt; geneticListObject = &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;CreateGenericObject(&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;&lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;typeof&lt;span style="color: rgb(0, 0, 0);"&gt;(List&amp;lt;&amp;gt;)&lt;/span&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;&lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;typeof&lt;span style="color: rgb(0, 0, 0);"&gt;(int));&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Now lets see one more feature of .NET 2.0 i.e. Inline functions&lt;/span&gt;&lt;/span&gt; &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;(anonymous methods)&lt;/span&gt;&lt;/span&gt;:&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p  class="MsoNormal" style="font-family:verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Lets assume you have a generic collection of objects (lets assume student); and you want to search on Student Name starting with "K". You dont need to make another call to the server for this. Here is the code for the same:&lt;/span&gt;&lt;/p&gt;  &lt;p face="verdana,sans-serif" class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="font-family: verdana,sans-serif;" class="MsoNormal"&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;&lt;span style="color:teal;"&gt;&lt;span style="color:teal;"&gt;List&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;&lt;span style="color:teal;"&gt;&lt;span style="color:teal;"&gt;Student&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&amp;gt; localStudentList =  mainStudentList.FindAll(&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;&lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;delegate&lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;(&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;&lt;span style="color:teal;"&gt;&lt;span style="color:teal;"&gt;Student&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style="font-size:85%;"&gt;student)&lt;br /&gt;            {&lt;br /&gt;               &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:85%;"  &gt;&lt;span style=";font-family:'Courier New';font-size:10pt;"  &gt;&lt;span style="color:teal;"&gt;&lt;span style="color:teal;"&gt;return&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style="font-size:85%;"&gt;student.StudentName.StartsWith("K");&lt;br /&gt;            });&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;the above code will return the list of students (in localStudentList object) whose name starts with K.To extends this you can write various AND and OR conditions. Isn't this good?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=";font-family:verdana,sans-serif;color:black;"  &gt;&lt;div dir="ltr"&gt;&lt;div&gt;&lt;span style="font-size:100%;"&gt;--&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Kaushal Patel&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div  style="padding: 5px 0pt;font-size:13.3px;"&gt;&lt;span style="color:gray;"&gt;Contact Me&lt;/span&gt;  &lt;a href="http://twitter.com/mail2kaushal" style="padding: 0pt 2px; color: blue; font-size: 10pt;"&gt;&lt;img src="http://www.images.wisestamp.com/twitter.png" alt="Twitter" style="vertical-align: middle; padding-bottom: 5px;" width="16" border="0" height="16" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-4093765557920499220?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/4093765557920499220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/4093765557920499220'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2010/03/playing-with-generic-list.html' title='Playing with Generic List'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-6200434349438669140</id><published>2010-03-03T23:13:00.001-08:00</published><updated>2010-03-12T02:34:32.575-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>BCL new features of the .NET Framework 4.0 Beta 2</title><content type='html'>&lt;span style="font-family:verdana,sans-serif;"&gt;Visual Studio 2010 and .NET Framework 4 Beta 2 are now available to &lt;/span&gt;&lt;a style="font-family: verdana,sans-serif;" href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;download&lt;/a&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;.  .NET 4 Beta 2 contains various newly introduced BCL features and enhancements in addition to what was included in the earlier version of .NET Framework 4.0 Beta 1&lt;/span&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;.  Many of these enhancements were added in large part due to specific feedback and suggestions reported by customers through &lt;/span&gt;&lt;a style="font-family: verdana,sans-serif;" href="https://connect.microsoft.com/VisualStudio/content/content.aspx?ContentID=14625"&gt;Microsoft Connect&lt;/a&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="font-family: verdana,sans-serif;"&gt;&lt;u&gt;New BCL Features in .NET Framework Beta 2.0&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;ol style="font-family: verdana,sans-serif;"&gt;&lt;li&gt;Complex Number&lt;/li&gt;&lt;li&gt;Location&lt;/li&gt;&lt;li&gt;Stream Copy (Stream.CopyTo)&lt;/li&gt;  &lt;li&gt;IObservable&amp;lt;T&amp;gt;&lt;/li&gt;&lt;li&gt;Enum.HasFlag&lt;/li&gt;&lt;li&gt;String.Connect &amp;amp; String.Join&lt;/li&gt;&lt;li&gt;String.IsNullOrWhiteSpace&lt;/li&gt;&lt;li&gt;TryParse (In Guid, Version and Enum)&lt;/li&gt;&lt;li&gt;&lt;i&gt;Addition &lt;/i&gt;Environment.SpecialFolder, Environment.Is64BitProcess and Environment.Is64BitOperatingSystem&lt;/li&gt;  &lt;li&gt;Path.Combine with params support&lt;/li&gt;&lt;li&gt;ObservableCollection&amp;lt;T&amp;gt; is now part of System.DLL&lt;/li&gt;&lt;li&gt;Int Pointer operations (IntPtr and UIntPtr Subtraction operators)&lt;/li&gt;&lt;li&gt;StringBuilder.Clear&lt;/li&gt;&lt;li&gt;ServiceInstaller.DelayedAutoStart&lt;/li&gt;  &lt;li&gt;StopWatch.Restart&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:black;"&gt;&lt;div dir="ltr"&gt;&lt;div&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;--&lt;/span&gt; &lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Kaushal Patel&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div   style="padding: 5px 0pt;font-family:arial,sans-serif;font-size:13.3px;"&gt;&lt;span style="color:gray;"&gt;Contact Me&lt;/span&gt;  &lt;a href="http://twitter.com/mail2kaushal" style="padding: 0pt 2px; color: blue; font-size: 10pt;"&gt;&lt;img src="http://www.images.wisestamp.com/twitter.png" alt="Twitter" style="vertical-align: middle; padding-bottom: 5px;" width="16" border="0" height="16" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-6200434349438669140?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/6200434349438669140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/6200434349438669140'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2010/03/bcl-new-features-of-net-framework-40.html' title='BCL new features of the .NET Framework 4.0 Beta 2'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-8375838828609360005</id><published>2010-03-03T09:08:00.001-08:00</published><updated>2010-03-12T02:35:00.869-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Task Parallel Library Sample is out now!!!</title><content type='html'>&lt;div&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Microsoft .NET Framework 4.0 TPL (Task Parallel Library) sample is out now. This sample has been created in .NET Framework 4.0 Beta 2&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;span style="font-family:Verdana;"&gt;&lt;a href="http://code.msdn.microsoft.com/ParExtSamples/Release/ProjectReleases.aspx?ReleaseId=3920"&gt;Click here&lt;/a&gt; to get the newest feature of .NET Framework 4.0&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-8375838828609360005?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8375838828609360005'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8375838828609360005'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2010/03/task-parallel-library-sample-is-out-now.html' title='Task Parallel Library Sample is out now!!!'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-7123398821117212313</id><published>2010-01-26T05:18:00.001-08:00</published><updated>2010-01-26T05:18:45.527-08:00</updated><title type='text'>Microsoft Blue &amp; Me</title><content type='html'>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 12"&gt;&lt;meta name="Originator" content="Microsoft Word 12"&gt;&lt;link style="font-family: verdana,sans-serif;" rel="File-List" href="file:///C:%5CUsers%5CKK%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;link style="font-family: verdana,sans-serif;" rel="themeData" href="file:///C:%5CUsers%5CKK%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link style="font-family: verdana,sans-serif;" rel="colorSchemeMapping" href="file:///C:%5CUsers%5CKK%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0cm; 	margin-right:0cm; 	margin-bottom:10.0pt; 	margin-left:0cm; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi; 	mso-fareast-language:EN-US;} p 	{mso-style-noshow:yes; 	mso-style-priority:99; 	mso-margin-top-alt:auto; 	margin-right:0cm; 	mso-margin-bottom-alt:auto; 	margin-left:0cm; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman";} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi; 	mso-fareast-language:EN-US;} .MsoPapDefault 	{mso-style-type:export-only; 	margin-bottom:10.0pt; 	line-height:115%;} @page Section1 	{size:612.0pt 792.0pt; 	margin:72.0pt 72.0pt 72.0pt 72.0pt; 	mso-header-margin:36.0pt; 	mso-footer-margin:36.0pt; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;  &lt;p style="font-family: verdana,sans-serif;"&gt;&lt;font size="2"&gt;&lt;b&gt;Blue&amp;amp;Me&lt;/b&gt; is a information &amp;amp; entertainment system that specially designed for Fiat Group cars as a part of Microsoft Auto initiatives and developed in a partnership which was started end of 2004 between Magenti (a Fiat group company) and MSFT. The system is based on modular structure which allows installation and use of uninformed services. The system offers various connectivity options like Bluetooth, USB, Mobile Phones, your personal media player along with hands-free operations allowing you to control all features by voice commands, using speech technology from Nuance Comm With the help of Magneti the system is developed to be compatible with most mobile phones and media players &lt;i&gt;Blue&amp;amp;Me Nav&lt;/i&gt; is a next version of the same OS which adds GPS related features. &lt;/font&gt;&lt;/p&gt;  &lt;font size="2"&gt;&lt;span style="line-height: 115%; font-family: verdana,sans-serif;"&gt;In india this os and its capabilities are not well known; at the Bologna Motor Show 2009, Fiat presented a new portable navigation unit addition to the Blue&amp;amp;Me system called Blue&amp;amp;Me Map. Exclusive for and to Fiat Professional&amp;#39;s light commercial vehicles.&lt;/span&gt;&lt;br style="font-family: verdana,sans-serif;" clear="all"&gt;&lt;br style="font-family: verdana,sans-serif;"&gt;&lt;/font&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-7123398821117212313?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/7123398821117212313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/7123398821117212313'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2010/01/microsoft-blue-me.html' title='Microsoft Blue &amp; Me'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-6859832266689910239</id><published>2010-01-01T01:37:00.000-08:00</published><updated>2010-01-01T01:39:55.211-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET Compact Framework'/><title type='text'>Visual Studio 2010 Beta 2</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;On the new years eve; microsoft launched its one of the major and popular development studio i.e Visual Studio 2010. Still its early to discuss the features and improvements that &lt;/span&gt;&lt;a href="http://vs.net/"&gt;&lt;span style="font-size:85%;"&gt;VS.NET&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt; 2010 provides. But keep watching this space for more on &lt;/span&gt;&lt;a href="http://vs.net/"&gt;&lt;span style="font-size:85%;"&gt;VS.NET&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:85%;"&gt; 2010 in coming days. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;To download &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/hi-in/vstudio/dd582936(en-us).aspx"&gt;&lt;span style="font-size:85%;"&gt;VS.NET 2010 with .NET Framework Beta 4.0&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-6859832266689910239?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/6859832266689910239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/6859832266689910239'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2010/01/visual-studio-2010-bita-2.html' title='Visual Studio 2010 Beta 2'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-8233463766630780053</id><published>2009-12-28T18:38:00.001-08:00</published><updated>2009-12-28T18:47:53.199-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Design Patterns'/><title type='text'>Different ways to Implement the Singleton in .NET</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style=";font-family:verdana,sans-serif;font-size:85%;"  &gt;Lots of blogs and sites are talking about the ways to implement the singleton in different ways; and surprisingly many of them some times miss the thread safety or the thread sync. According to the "Design Patterns: Elements of Reusable Object-Oriented Software"&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;the implementation of Singleton should be as follow:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_KrOZECSJ9C8/SzlsLB4OODI/AAAAAAAAC2g/Bj8TWAZ8R4c/s1600-h/SingleTon+First.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 326px; height: 400px;" src="http://2.bp.blogspot.com/_KrOZECSJ9C8/SzlsLB4OODI/AAAAAAAAC2g/Bj8TWAZ8R4c/s400/SingleTon+First.jpg" alt="" id="BLOGGER_PHOTO_ID_5420482563255711794" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;The above implementation may work well considering that singleton implementation can be breakable at the first call. In "GetInstance" method we are checking "instance ==  null" which returns true when 2 requests comes at the same time at the first call. Plus we are not taking the advantage of the .NET language features. Here is the thread safe implementation of Singleton in .NET C# language.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_KrOZECSJ9C8/SzlsRha7z1I/AAAAAAAAC2o/s5zNeEg8nvw/s1600-h/SingleTon+Two.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 374px; height: 400px;" src="http://1.bp.blogspot.com/_KrOZECSJ9C8/SzlsRha7z1I/AAAAAAAAC2o/s5zNeEg8nvw/s400/SingleTon+Two.jpg" alt="" id="BLOGGER_PHOTO_ID_5420482674802020178" border="0" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;span style="font-size:85%;"&gt;Here you need to watch the usage of &lt;a href="http://msdn.microsoft.com/en-us/library/x13ttww7%28VS.71%29.aspx"&gt;volatile &lt;/a&gt;(One can consider the implementation of "volatile" exactly opposite of "ThreadStatic" keyword) and static keyword gives the grantee to be thread safe in .NET compilation. (According to Jeffrey Richter).&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-8233463766630780053?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8233463766630780053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8233463766630780053'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2009/12/different-ways-to-implement-singleton.html' title='Different ways to Implement the Singleton in .NET'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_KrOZECSJ9C8/SzlsLB4OODI/AAAAAAAAC2g/Bj8TWAZ8R4c/s72-c/SingleTon+First.jpg' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-8031255349268422931</id><published>2009-12-16T06:34:00.000-08:00</published><updated>2009-12-16T07:29:20.463-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><title type='text'>Microsoft Dublin &amp; Velocity</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Microsoft Windows Server &lt;/span&gt;AppFebric&lt;span style="font-family:verdana,sans-serif;"&gt; (Dublin and Velocity) is a bundle of integrated technologies which makes easier to &lt;/span&gt;develope&lt;span style="font-family:verdana,sans-serif;"&gt;, extend and manage the web and composite application that runs on &lt;/span&gt;IIS&lt;span style="font-family:verdana,sans-serif;"&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;" class="gmail_quote"&gt;  &lt;span style="font-family:verdana,sans-serif;"&gt; &lt;div&gt;&lt;br /&gt;If you are searching for the Windows Azure platform AppFabric, which helps developers connect apps and services between Windows Azure and on-premises deployments, see the &lt;a href="http://www.microsoft.com/windowsazure/dotnetservices/" target="_blank"&gt;&lt;span style="color: rgb(0, 102, 221);"&gt;Windows Azure site&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;    &lt;div&gt; &lt;/div&gt; &lt;div&gt;&lt;b&gt;What is Dublin?&lt;/b&gt;&lt;/div&gt; &lt;div&gt; &lt;/div&gt; &lt;div&gt;&lt;br /&gt;Dublin enriches Windows Server to give enhanced hosting and management capabilities for WCF and WF services. Dublin also adds service management extensions to the hosting features of Internet Information Services (IIS) and Windows Activation Service (WAS), and the run-time components and services of the .NET Framework 4. Dublin addresses the challenges of hosting WCF- and WF-based applications by making it easier to deploy, configure, and manage applications.&lt;br /&gt;&lt;br /&gt;Typically in Service Oriented Architecture people are building the service for the different operations and exposes these services to the consumer to consume. Since WCF and WF released; the deployment, monitoring and scaling these services never been an easy task. Some times to consuming these service it self a trouble making task. With the help of Dublin we can perform these tasks almost effortless. Dublin can be easily introduced through IIS management console using the Dublin module of Windows Power Shell.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is Velocity?&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Velocity is a highly scalable in-memory caching mechanism using which one can improve the performance of the application with all types of data. For any application one can leverage the Velocity rather then writing new caching schema. Velocity comes with Dublin; the same setup programme installs Velocity and Dublin.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;  &lt;div&gt; For more details about the architecture details please &lt;a href="http://msdn.microsoft.com/en-us/library/ee677175.aspx"&gt;Click Here&lt;/a&gt;!!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Keep watching this space for more technical updates.&lt;br /&gt;&lt;/div&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-8031255349268422931?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8031255349268422931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8031255349268422931'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2009/12/microsoft-dublin.html' title='Microsoft Dublin &amp; Velocity'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-6644863905810629808</id><published>2009-12-16T04:57:00.001-08:00</published><updated>2009-12-16T07:30:06.600-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><title type='text'>Microsoft released Web Platform Installer 2.0</title><content type='html'>&lt;div&gt;&lt;font face="verdana,sans-serif"&gt;Commonly known as Web PI; a tool that makes user life easier to sync up with the latest updates for the MS products like Internet Information Services (IIS), Visual Web Developer, .NET Framework, SQL Server Express Edition etc. (List goes on and on and on......). The Web PI has Windows Web Application Gallery using which you can users can have pleasant experience whle blogging. It also provides the support for Content Management Activities. &lt;/font&gt;&lt;/div&gt;   &lt;div&gt;&lt;font face="verdana,sans-serif"&gt;&lt;/font&gt; &lt;/div&gt; &lt;div&gt;&lt;font face="Verdana"&gt;&lt;/font&gt; &lt;/div&gt; &lt;div&gt;&lt;font face="Verdana"&gt;For downloading Web PI 2.0 &lt;a href="http://www.microsoft.com/web/downloads/platform.aspx"&gt;Click Here&lt;/a&gt;!!&lt;/font&gt;&lt;/div&gt; &lt;div&gt; &lt;/div&gt; &lt;div&gt;&lt;font face="verdana,sans-serif"&gt;For more technical updates and latest technology news keep watching this space,&lt;/font&gt;&lt;/div&gt; &lt;div&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-6644863905810629808?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/6644863905810629808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/6644863905810629808'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2009/12/microsoft-released-web-platform.html' title='Microsoft released Web Platform Installer 2.0'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-8049667645077856933</id><published>2009-06-30T10:00:00.001-07:00</published><updated>2009-06-30T10:15:27.150-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>All about WCF (Introduction)</title><content type='html'>&lt;p class="MsoNormal" style="margin-left:36.0pt"&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left:36.0pt"&gt;&lt;/p&gt;&lt;div style="text-align: left;"&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;p style="text-align:justify"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Here in my first series of article I will be sharing top to bottom of the WCF (The Indigo).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-align:justify"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;WCF is the great way to approach large multi-system message based communication. It seamlessly support Transaction Management, Security Implementation, Exception and Fault handling. Concurrency management etc.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-align:justify"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Usage of WCF comes with the great amount of flexibilities' to handle. WCF is a framework for services. The user can Create, Configure, Host and consume the services. All the services are mutually agreed on SOAP concept and communicating between WCF based clients.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-align:justify"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;WCF has mainly two categories of classes:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-left:42.0pt;text-align:justify;text-indent:-18.0pt"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;1.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Service Model Class (Handles Service Configurations &amp;amp; Validations).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-left:42.0pt;text-align:justify;text-indent:-18.0pt"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;2.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Channel Classes (Handles mode of communication and related functionalities).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-align:justify"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Each WCF service can be associated with one ore more service endpoints. One service can be hosted in WCF with different mode of communication channel. Depending upon the usage and target client WCF Service can be configured (I will focus this more on this in my up coming articles).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-align:justify"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Configuring endpoints require (A, B &amp;amp; C):&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-left:42.0pt;text-align:justify;text-indent:-18.0pt"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;1.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Address ('A') = Where?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-left:42.0pt;text-align:justify;text-indent:-18.0pt"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;2.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Binder ('B') = How?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin-left:42.0pt;text-align:justify;text-indent:-18.0pt"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;3.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Contract ('C') = What?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-align:justify"&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Address:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;b&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The address means the URL/URI where the service is located.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Where is the service located?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Binder:&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;b&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;mode ofcommunication.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;How to communicate with the service?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Contract:&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The Service.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;What is my service?&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-align:justify"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;With the XML Based configuration approach OR with the help of coding we can configure the endpoints.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style="font-family:&amp;quot;;color:#333333;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;b&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Hosting WCF Service&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;WCF Service is can be segregated in to two parts normally:&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpFirst" style="text-align: justify;text-indent: -18pt; "&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;                &lt;/span&gt;&lt;/span&gt;1.&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Service Contract &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpLast" style="text-align: justify;text-indent: -18pt; "&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;               &lt;/span&gt; &lt;/span&gt;2.&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Service Implementation&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; -webkit-text-decorations-in-effect: underline; "&gt;Service Contract:&lt;/span&gt;&lt;/div&gt;&lt;b&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;Service Contract is just the collection of functionality that Service will be exposed. In a way you can assume that a Service Contract is just like the interfaces in .NET.&lt;/span&gt;&lt;/div&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a href="http://8ulooq.bay.livefilestore.com/y1phMVXAOI9rP-nhYhvy2yFDsMCxj3j2mVUYNuTmNfuKq_U6Z5AxvI7q1Nm-RItvVMDV75TToMiXfes_OiLdGNL0Q/Example1.jpg"&gt;For example&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;In above example, I have created a sample service with just one operation i.e. MyOperation with one parameter. As you can see i have used Attributes. ServiceContract attributes comes under &lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;System.ServiceModel. &lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Including this DLL as in reference list is must for WCF Service Host and WCF Consumer.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;You can create multiple operations by using "OperationContract" attribute. By specifying OperationContract attribute means the operation will be available for WCF Service and the WCF client can consume that.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; -webkit-text-decorations-in-effect: underline; "&gt;Service Implementation:&lt;/span&gt;&lt;/div&gt;&lt;b&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;As named Service implementation is the implementation bin of WCF Service Contract. &lt;/span&gt;&lt;b&gt;&lt;u&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;You can implement this WCF Service Interface in 'N' number of classes.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a href="http://cid-50e44036e49794b4.skydrive.live.com/self.aspx/Public/Tech-Updates/Example2.jpg?sa=415233573"&gt;For example&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;In above example I have created "HelloIndigoService" which is implementing our "IHelloIndigoService" service interface. &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;WCF Service can be self-hosted service but to start with we will see simple .NET consol based hosting mechanism. &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;b&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Attributes of Service Contract&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Using declarative model you can apply different parameters (as per your requirements) on WCF Service Contract:&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph"&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;CallbackContract&lt;/span&gt;&lt;/div&gt;&lt;b&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;User can specify the call-back service that represents opposite service contract in duplex message exchange.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a href="http://8ulooq.bay.livefilestore.com/y1pSJfCcvN9CXsFoqI1swefZhAcaRGwpCS0KAORw3KAjk8c6OWftH96b-TmPk2X28A-Yjizfuu4inG0R-R_3_qNdQ/Example3.jpg"&gt;Example&lt;/a&gt;&lt;/div&gt;&lt;/b&gt;  &lt;p class="MsoListParagraphCxSpFirst"&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;ConfigurationName&lt;/span&gt;&lt;/div&gt;&lt;b&gt;&lt;div style="text-align: justify;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;User can specify the pre-created configuration name which is/are defined in Application's configuration file.&lt;/span&gt;&lt;/div&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a href="http://8ulooq.bay.livefilestore.com/y1pVcErwCpQJt6xc450erzxawh5G-QY3tmhksfEMdX1jqZV9d0e3LaRcwS4eaXkgZALRW7PxR5arJEbUYzm6shr9w/Example4.jpg"&gt;Example&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Name:&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Name property is impacting on WSDL generation. With the help of this property user can specify XML Root Tag name of WSDL. Unlike the older messaging mechanisms, WCF provides great deal of control over WSDL generation. I will discuss more about forming the WSDL with OperationContract later in this article.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a href="http://8ulooq.bay.livefilestore.com/y1pVcErwCpQJt4Kgdm3bIkref4NDy1nc5Pf90HYytt6IbuljQMUedXnHQl0tlep06yemd3N0EM1U4baQxi86YZMPg/Example5.jpg"&gt;Example&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Namespace:&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Namespace is also related with WSDL formation. After you generated the proxy of WCF Service; the given namespace will be appear in WSDL Namespace.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a href="http://8ulooq.bay.livefilestore.com/y1pL6BMkrUj0OX7EoqgqMdymQLuAqrXSjccwdt7ZYnyseq-4mknO4J7dhwmrFwvo7syD1g6xo_B7Oscgfq92OeDBw/Example6.jpg"&gt;Example&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;ProtectionLevel:&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;User needs to use ProtectionLevel according to their service requirements and the operations that service will be exposing. There are three different ProtectinLevels are available.&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;margin-left: 54pt; text-indent: -18pt; "&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;1.&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="line-height: 115%;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;font-family:&amp;quot;;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;None: &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpMiddle" style="text-align: justify;margin-left: 54pt; text-indent: -18pt; "&gt;&lt;b&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;2.&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="line-height:115%;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-family:&amp;quot;;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Sign: &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="line-height:115%;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-family:&amp;quot;;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;protected part is signed&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;digitally to ensure the temper less submission of data&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpLast" style="text-align: justify;margin-left: 54pt; text-indent: -18pt; "&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="font-family:Calibri;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;3.&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="line-height: 115%;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;font-family:&amp;quot;;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;EncryptAndSign: &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="line-height:115%; Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;font-family:&amp;quot;;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;This will encrypt data before sighed it digitally.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-align: justify;margin-left: 36pt; "&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;More details on ProtectionLevel : &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa347692.aspx"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;http://msdn.microsoft.com/en-us/library/aa347692.aspx&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpFirst"&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;SessionMode&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;:&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;div style="text-align: justify;"&gt;Specifying the attribute with "Allowed", "NotAllowed" and "Required". As name says "NotAllowed" will not support Session. The main difference between "Allowed" and "Required" is: "Allowed" will support Session persistent if incoming binding supports. Where as "Required" will throw an error in case binding is not supporting.&lt;/div&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpLast"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left:36.0pt"&gt;    &lt;b style="mso-bidi-font-weight:normal"&gt;&lt;/b&gt;&lt;/p&gt;&lt;/div&gt; &lt;b style="mso-bidi-font-weight:normal"&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt; &lt;b style="mso-bidi-font-weight:normal"&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-8049667645077856933?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8049667645077856933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8049667645077856933'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2009/06/test_30.html' title='All about WCF (Introduction)'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-8509063982138138767</id><published>2009-03-13T20:46:00.000-07:00</published><updated>2009-03-13T20:54:22.332-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>ASP.NET Cookieless Session [Pros &amp; Cons]</title><content type='html'>&lt;p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; line-height:11.85pt;mso-outline-level:2"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span style="mso-tab-count:1"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; line-height:11.85pt;mso-outline-level:2"&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Enter Cookieless Sessions&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; line-height:11.85pt;mso-outline-level:2"&gt;&lt;span class="apple-style-span"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;you don't have to change anything in your ASP.NET application to enable cookieless sessions, just enter sessionState cookieless="true" in your web.config.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; line-height:11.85pt;mso-outline-level:2"&gt;&lt;span class="Apple-style-span" style="font-family: verdana;"&gt;&lt;pre style="line-height:11.85pt"&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;  &lt;pre style="line-height:11.85pt"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;sessionstate cookieless="true"&gt;&lt;/sessionstate&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; line-height:11.85pt;mso-outline-level:2"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;span style=" ;color:black;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Internal Implementation of Cookieless Session in ASP.NET&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The implementation of cookieless sessions includes couple of runtime modules:&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListParagraphCxSpFirst" style="margin-bottom:7.9pt;mso-add-space: auto;text-indent:-18.0pt;line-height:11.85pt;mso-list:l0 level1 lfo1"&gt;&lt;b style="mso-bidi-font-weight:normal"&gt;&lt;span style=" ;color:black;"&gt;&lt;span style="mso-list:Ignore"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;1.   1.&lt;/span&gt;&lt;/span&gt;&lt;span style="font:7.0pt &amp;quot;Times New Roman&amp;quot;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b style="mso-bidi-font-weight:normal"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;SessionStateModule &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;[A standard session HTTP Module]&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="line-height: normal; "&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight:normal"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; 2. Aspnet_filter.dll &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;[Works as an executable]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Once the HTTP Request come at the server, a small piece of Win32 code works as an ISAPI filter. HTTP modules and ISAPI filters are in opinion of the same concept, except that HTTP modules are created by the managed code and require ASP.NET and CLR to trigger and work. Classic ISAPI filters like aspnet_filter.dll are invoked by IIS. Both capture IIS events fired during the processing of the request.&lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight:normal"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;When the first request of a new browser session comes at server to process, the &lt;/span&gt;&lt;/span&gt;&lt;b style="mso-bidi-font-weight:normal"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;SessionStateModule&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; reads about the cookie support in the web.config file [By default “machine.config” specifies cookie enabled session]. If the “&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;cookieless” &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;attribute of the &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;sessionstate&gt; &lt;/sessionstate&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;section is set to true, the module generates a new session ID, twists the URL by appending the session ID just before the requested page name, and redirects the browser to the newly created URL using the “HTTP 302 command”.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;When each request reaches at the IIS boundary—far before it is handed over to ASP.NET—aspnet_filter.dll is given a chance to look at it. If the URL appends a session ID in parentheses, then the session ID is extracted and copied into a request header called &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;AspFilterSessionId&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;. The URL is then rewritten to exactly like the originally requested resource and let go. This time the ASP.NET session state module retrieves the session ID from the request header and proceeds with session-state binding.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The cookieless mechanism works great as long as the URL contains information that can be used to obtain the session ID. As you'll see in a moment, this poses some usage restrictions.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Let's review the pros and cons of cookieless sessions.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; line-height:11.85pt;mso-outline-level:2"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Advantages of Cookieless Session&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;In ASP.NET, session management and forms authentication are the only two system features that use cookies under the hood. With cookieless sessions, you can now deploy stateful applications that work regardless of the user's preferences about cookies. As of ASP.NET 1.x, though, cookies are still required to implement forms authentication. The good news is that in ASP.NET 2.0 forms authentication can optionally work in a cookieless fashion.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Another common reason advanced against cookies is security. This is a point that deserves a bit more attention.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Cookies are inert text files and as such can be replaced or poisoned by hackers, should they gain access to a machine. The real threat lies not much in what cookies can install on your client machine, but in what they can upload to the target site. Cookies are not programs and never run like programs; other software that gets installed on your machine, though, can use the built-in browser support for cookies to do bad things remotely.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Furthermore, cookies are at risk of theft. Once stolen, a cookie that contains valuable and personal information can disclose its contents to malicious hackers and favor other types of Web attacks. &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto; line-height:11.85pt;mso-outline-level:2"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Disadvantages of Cookieless Session&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;By looking the advantages of cookieless session we should not reach on any conclusion: Considering security aspect, your cookieless sessions are easier to hack in compare. &lt;/span&gt;&lt;/span&gt;&lt;a href="http://technet.microsoft.com/en-au/magazine/2005.01.sessionhijacking.aspx"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Session Hijacking&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; can act against this approach.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;In brief, session hijacking occurs when an attacker gains access to the session state of a particular user. Basically, the attacker steals a valid session ID and uses that to get into the system and snoop into the data. One common way to get a valid session ID is stealing a valid session cookie. That said, if you think that cookieless sessions put your application on the safe side, you're deadly wrong. With cookieless sessions, in fact, the session ID shows up right in the address bar&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;With cookieless sessions, stealing session IDs is easier than ever.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Using cookieless sessions also raises issues with links. For example, you can't have absolute, fully qualified links in your ASP.NET pages. If you do this, each request that originates from that hyperlink will be considered as part of a new session. Cookieless sessions require that you always use relative URLs, like in ASP.NET postbacks. You can use a fully qualified URL only if you can embed the session ID in it. But how can you do that, since session IDs are generated at run time?&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The following code breaks the session:&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height:11.85pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a runat="server" href="http://www.blogger.com/test/page.aspx"&gt;Click&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;To use absolute URLs, resort to a little trick that uses the &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;ApplyAppPathModifier&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; method on the &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;HttpResponse&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; class:&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="line-height:11.85pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;a runat="server"&gt;&lt;/a&gt;&lt;/span&gt;&lt;a runat="server"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;a runat="server"&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;a runat="server"&gt;  &lt;/a&gt;&lt;p class="MsoNormal" style="line-height:11.85pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt"&gt;&lt;a runat="server"&gt;&lt;span style=" ;color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;href= &gt;Click&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:7.9pt;line-height:11.85pt"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;The &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;ApplyAppPathModifier&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; method takes a string representing a URL and returns an absolute URL that embeds session information. For example, this trick is especially useful in situations in which you need to redirect from a HTTP page to an HTTPS page. &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-8509063982138138767?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8509063982138138767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8509063982138138767'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2009/03/enter-cookieless-sessions-you-dont-have.html' title='ASP.NET Cookieless Session [Pros &amp; Cons]'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-7409118261173212995</id><published>2009-03-13T02:32:00.001-07:00</published><updated>2009-03-13T08:45:21.502-07:00</updated><title type='text'>Google Talk Hacks</title><content type='html'>&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;You can edit most settings by opening regedit and by selecting  HKEY_CURRENT_USER/Software/Google/Google Talk.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;&lt;em&gt;Accounts:&lt;/em&gt;&lt;/strong&gt; This one has subkeys for different accounts that has logged in on the your PC. These keys have different values that store the username, password and connection options.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;strong&gt;&lt;em&gt;Options:&lt;/em&gt;&lt;/strong&gt; This is the most interesting part of GTalk, where most of the current hacks should be used.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. HKEY_CURRENT_USER\Software\Google\Google Talk\Options\show_pin If "1", shows a "pin" next to the minimize button that keeps the windows on top of all the other open windows when clicked.&lt;br /&gt;&lt;br /&gt;2. HKEY_CURRENT_USER\Software\Google\Google Talk\Options\view_show_taskbutton If "0", hides the taskbar button, and leaves the tray icon only, when the window is shown&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;3. HKEY_CURRENT_USER\Software\Google\Google Talk\Options\away_inactive If "1", status will be set as Away after the specified number of MINUTES.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;4. HKEY_CURRENT_USER\Software\Google\Google Talk\Options\away_screensaver If "1", status will be set as Away after the specified number of MINUTES.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;5. HKEY_CURRENT_USER\Software\Google\Google Talk\Options\inactive_minutes Number of inactive MINUTES to become away if auto-away is on.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:verdana;"&gt;Use multiple-identities with GTalk:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;1. Right-click on the desktop&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;2. Select New&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;3. Select Shortcut&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;4. Paste this into the text box: (&lt;strong&gt;"C:\Program Files\Google\Google Talk\googletalk.exe"&lt;/strong&gt;&lt;em&gt;&lt;strong&gt; /nomutex &lt;/strong&gt;)&lt;/em&gt;&lt;br /&gt;5. Click Next and choose a shortcut name like "GTalk New Instance".&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;Here you go.... try to execute this newly created short-cut and use your alternate GTalk ID.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;/nomutex,           which allows you to run more than one instance of GT.&lt;br /&gt;/autostart,          when Google Talk is run with this parameter, it will check the registry settings to see if it needs to be started or not. If the "Start automatically with Windows" option is unchecked, it won't start.&lt;br /&gt;/forcestart,         same as /autostart, but forces it to start no matter what option was set.&lt;br /&gt;/S upgrade,         Used when upgrading Google Talk&lt;br /&gt;/register:            registers Google Talk in the registry, includig the GMail Compose method.&lt;br /&gt;/checkupdate:     check for newer versions&lt;br /&gt;/plaintextauth:     uses plain authentication mechanism instead then Google's GAIA mechanism. Used for testing the plain method on Google's servers.&lt;br /&gt;/nogaiaauth:        disables GAIA authentication method. The same as above.&lt;br /&gt;/factoryreset:      set settings back to default.&lt;br /&gt;/gaiaserver &lt;/span&gt;&lt;a href="http://servername.com/"&gt;&lt;span style="font-family:verdana;"&gt;domain.com&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;"&gt;: uses a different GAIA server to connect to Google Talk. Used for debug purposes only, there are no other known GAIA servers.&lt;br /&gt;/mailto &lt;/span&gt;&lt;a href="mailto:emailid@domain.com"&gt;&lt;span style="font-family:verdana;"&gt;emailid@domain.com&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;"&gt;: send an email with Gmail&lt;br /&gt;/diag: start Google Talk in diagnostic mode&lt;br /&gt;/log: probably has something to do with the diagnostic logging&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;To add these, open up your GTalk shortcut, and where it says "Target:" add one or more of these inside the quotations, but after the .exe part&lt;/strong&gt;&lt;br /&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-7409118261173212995?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/7409118261173212995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/7409118261173212995'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2009/03/google-talk-hacks.html' title='Google Talk Hacks'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-748357017038389012</id><published>2008-09-16T23:25:00.001-07:00</published><updated>2008-09-26T22:01:28.763-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><title type='text'>CX1 (A super comp from Cray) will have Windows HPC Server 2008</title><content type='html'>&lt;div dir="ltr"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Microsoft and Cray on Tuesday took the wraps off a petite supercomputer that runs Windows HPC Server 2008 and, unlike some other supercomputers, doesn't cost more than a Hummer limo. &lt;/span&gt; &lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;In fact, Cray's new CX1 supercomputer is priced starting at a relatively cheap $25,000, not bad for an integrated box that weaves together compute, storage, and visualization functions. Cray has designed the CX1 to remove some of the complexity involved with supercomputing that has hindered its adoption, particular in smaller organizations. &lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Based on 64-bit Windows Server 2008, Windows HPC Server 2008 can scale to thousands of processing cores and features high end management capabilities that span both Windows and Linux platforms. The CX1 uses up to 8 nodes and 16 Intel Xeon processors, with up to 64 gigabytes of memory per node; and also includes up to 4 terabytes of internal storage. &lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;The CX1 is the first Cray supercomputer to use Intel processors, and is also the first fruit from the pact the two companies announced in April to work together on supercomputing systems and technologies over the next few years. &lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;The CX1 is available through Cray's Website and comes with a three-year warranty that includes next-day, on-site Cray-certified support. &lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Supercomputers help power research in a wide variety of fields, including aerospace, astrophysics, bioinformatics, chemical physics, climate change prediction, medical imaging and the global ATLAS project, which is investigating the forces that govern the universe. &lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-748357017038389012?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/748357017038389012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/748357017038389012'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/09/cx1-super-comp-from-cray-will-have.html' title='CX1 (A super comp from Cray) will have Windows HPC Server 2008'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-2150536300353133141</id><published>2008-09-16T23:21:00.001-07:00</published><updated>2008-09-26T22:03:01.245-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Google News'/><title type='text'>T-Mobile to announce G-Phone late sept.</title><content type='html'>&lt;div dir="ltr"&gt;&lt;div&gt; &lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;T-Mobile USA will become the first company in the world to announce a mobile phone based on Google's Android OS &lt;/span&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;at a New York press conference Sept. 23, the New York Times reports&lt;/span&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;, citing T-Mobile.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;The handset was manufactured by Taiwan's High Tech Computer (HTC), the Times said. HTC representatives in Taipei declined to comment on the report.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Several other Web sites are also reporting the Sept. 23 event, including Gizmodo, which is displaying what appears to be an announcement &lt;/span&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;from T-Mobile.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;HTC has already said it is developing a mobile phone developed around Google's Android  &lt;/span&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;and plans to call the handset "Dream."&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;The handset maker may end up being first in the world to put out an Android-based mobile phone, but other companies are also developing handsets around Android, including Samsung Electronics.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;HTC's Google handset is just over 5-inches long and 3-inches wide, with a keypad underneath the screen that either slides out or swivels out. The aim of the keypad is for easy e-mail, note-taking and writing Web addresses.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Internet navigational controls are situated below the screen on the handset. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Android is an open source software platform that includes an OS and is designed to take advantage of Internet services for mobility. The software could become a potent new rival to Windows Mobile and other handset operating systems. At the launch ceremony early this year, Google announced that over 30 companies had joined the Open Handset Alliance.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-2150536300353133141?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/2150536300353133141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/2150536300353133141'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/09/t-mobile-to-announce-g-phone-late-sept.html' title='T-Mobile to announce G-Phone late sept.'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-6108014114445808418</id><published>2008-08-13T09:39:00.001-07:00</published><updated>2008-08-13T09:46:01.755-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Microsoft Introduces Zermatt [A Claim-based identity model]</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;Most developers are not security experts and many feel uncomfortable being given the job of authenticating, authorizing, and personalizing experiences for users. It's not a subject that has been traditionally taught in computer science curriculum, and there's a long history of these features being ignored until late in the software development lifecycle. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;It's not surprising nowadays to see a single company with tens or hundreds of web applications and services, many of which have their own private silo for user identities, and most of which are hardwired to use one particular means of authentication. Developers know how tedious it is to build identity support into each application, and IT pros know how expensive it is to manage the resulting set of applications. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;One very useful step toward solving the problem has been to centralize user accounts into an &lt;/span&gt;&lt;i&gt;&lt;span style="font-family:verdana;"&gt;enterprise directory&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family:verdana;"&gt;. Commonly it's the IT pro that knows the most effective and efficient way to query the directory, but today the task is typically left up to the developer. And in the face of mergers, acquisitions, and partnerships, the developer might be faced with accessing more than one directory, using more than one API. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;In the Microsoft .NET Framework, there are lots of different ways of building identity support into an application, and each communication framework treats identity differently, with different object models, different storage models, and so on. Even in &lt;a href="http://asp.net/"&gt;ASP.NET&lt;/a&gt;, developers can get confused about where they should look for identity: should they look at the HttpContext.User property? What about Thread.CurrentPrincipal? &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;The rampant use of passwords has lead to a cottage industry for phishers&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;1. And with so many applications doing their own thing, it's difficult for a company to upgrade to stronger authentication techniques. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;strong&gt;What is Zermatt All About?&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Zermatt is a set of .NET Framework classes; it is a framework for implementing claims-based identity in your applications. By using it, you'll more easily reap the benefits of claims-based systems described in this paper. Zermatt can be used in any web application or web service that uses the .NET Framework version 3.5.&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Download : &lt;a href="http://cid-50e44036e49794b4.skydrive.live.com/self.aspx/Public/Tech-Updates/ZermattForDevelopers.pdf"&gt;Zermatt Dev. Whitepaper&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-6108014114445808418?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/6108014114445808418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/6108014114445808418'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/08/microsoft-introduces-zermatt-claim.html' title='Microsoft Introduces Zermatt [A Claim-based identity model]'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-3383848854332128806</id><published>2008-06-12T07:15:00.000-07:00</published><updated>2008-11-12T23:40:59.500-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><title type='text'>WPF Namespace Poster</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_KrOZECSJ9C8/SFEvyP5408I/AAAAAAAABu8/m7QKRQJ6_8c/s1600-h/wpf"&gt;&lt;img id="BLOGGER_PHOTO_ID_5210998784153670594" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_KrOZECSJ9C8/SFEvyP5408I/AAAAAAAABu8/m7QKRQJ6_8c/s400/wpf" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-3383848854332128806?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/3383848854332128806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/3383848854332128806'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/06/wpf-namespace-poster.html' title='WPF Namespace Poster'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_KrOZECSJ9C8/SFEvyP5408I/AAAAAAAABu8/m7QKRQJ6_8c/s72-c/wpf' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-715308977203847756</id><published>2008-06-12T06:48:00.001-07:00</published><updated>2008-06-12T07:09:10.238-07:00</updated><title type='text'>.NET Coding Guidelines</title><content type='html'>&lt;span style="font-family:verdana,sans-serif;font-size:130%;"&gt;&lt;strong&gt;1. Tabs &amp;amp; Indenting&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;br clear="all"&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Avoid tab characters (\0x09) usage in code. 4 Space charactors should be use unsteade.&lt;/span&gt;&lt;/p&gt;&lt;h4&gt;&lt;a name="_Toc6325242"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;2 Bracing&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Open braces should always be at the beginning of the line after the statement that begins the block. Contents of the brace should be indented by 4 spaces. For example:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;if (someCondition)&lt;br /&gt;{&lt;br /&gt;DoSomething();&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;DoSomethingElse();&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;strong&gt;"case" statements should be indented from the switch statement like this:&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;switch (someExpression)&lt;br /&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;case 0:&lt;br /&gt;DoSomething();&lt;br /&gt;break;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;case 1:&lt;br /&gt;DoSomethingElse();&lt;br /&gt;break;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;case 2:&lt;br /&gt;{&lt;br /&gt;int n = 1;&lt;br /&gt;DoAnotherThing(n);&lt;br /&gt;}&lt;br /&gt;break;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;strong&gt;Braces should never be considered optional&lt;/strong&gt;. Even for single statement blocks, you should always use braces. This increases code readability and maintainability of your code.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;h4&gt;3&lt;a name="_Toc6325243"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt; Single line statements&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Single line statements can have braces that begin and end on the same line.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;public class Foo&lt;br /&gt;{&lt;br /&gt;int bar;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;public int Bar&lt;br /&gt;{&lt;br /&gt;get { return bar; }&lt;br /&gt;set { bar = value; }&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;strong&gt;It is &lt;i&gt;suggested&lt;/i&gt; that all control structures (if, while, for, etc.) use braces, but it is not required.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;h4&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;4 Commenting&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Comments should be used to describe intention, logical as well as execution flow, algorithmic overview. It would be ideal, if from reading the comments alone, someone other than the author could understand a function's intended behavior and general operation. While there are no minimum comment requirements and certainly some very small routines need no commenting at all, it is hoped that most routines will have comments reflecting the programmer's intent and approach.&lt;/span&gt;&lt;/p&gt;&lt;h5&gt;&lt;a name="_Toc530151483"&gt;&lt;/a&gt;&lt;a name="_Toc6325244"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Copyright notice&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Each file should start with a copyright notice. To avoid errors in doc comment builds, you don't want to use triple-slash doc comments, but using XML makes the comments easy to replace in the future. Final text will vary by product (you should contact legal for the exact text), but should be similar to:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;//-----------------------------------------------------------------------&lt;br /&gt;// &amp;lt;copyright file="ContainerControl.cs" company="Microsoft"&amp;gt;&lt;br /&gt;// Copyright (c) Microsoft Corporation. All rights reserved.&lt;br /&gt;// &amp;lt;/copyright&amp;gt;&lt;br /&gt;//-----------------------------------------------------------------------&lt;/span&gt;&lt;/p&gt;&lt;h5&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Documentation Comments&lt;/span&gt;&lt;/h5&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;All methods should use XML doc comments. For internal dev comments, the &amp;lt;devdoc&amp;gt; tag should be used.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;public class Foo&lt;br /&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;/// &amp;lt;summary&amp;gt;Public stuff about the method&amp;lt;/summary&amp;gt;&lt;br /&gt;/// &amp;lt;param name="bar"&amp;gt;What a neat parameter!&amp;lt;/param&amp;gt;&lt;br /&gt;/// &amp;lt;devdoc&amp;gt;Cool internal stuff!&amp;lt;/devdoc&amp;gt;&lt;br /&gt;///&lt;br /&gt;public void MyMethod(int bar) { … }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;However, it is common that you would want to move the XML documentation to an external file – for that, use the &amp;lt;include&amp;gt; tag.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;public class Foo&lt;br /&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;/// &amp;lt;include file='doc\Foo.uex' path='docs/doc[@for="Foo.MyMethod"]/*' /&amp;gt;&lt;br /&gt;///&lt;br /&gt;public void MyMethod(int bar) { … }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;UNDONE§ there is a big doc with all the comment tags we should be using… where is that?&lt;/span&gt;&lt;/p&gt;&lt;h5&gt;C&lt;a name="_Toc6325245"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;omment Style&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;The // (two slashes) style of comment tags should be used in most situations. Where ever possible, place comments above the code instead of beside it. Here are some examples:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;// This is required for WebClient to work through the proxy&lt;br /&gt;GlobalProxySelection.Select = new WebProxy("&lt;a href="http://itgproxy/"&gt;http://itgproxy/&lt;/a&gt;");&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;// Create object to access Internet resources&lt;br /&gt;//&lt;br /&gt;WebClient myClient = new WebClient();&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Comments can be placed at the end of a line when space allows:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;public class SomethingUseful&lt;br /&gt;{&lt;br /&gt;private int itemHash; // instance member&lt;br /&gt;private static bool hasDoneSomething; // static member&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;h4&gt;&lt;a name="_Toc6325246"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;5 Spacing&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Spaces improve readability by decreasing code density. Here are some guidelines for the use of space characters within code:&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;u&gt;Do&lt;/u&gt; use a single space after a comma between function arguments.&lt;br /&gt;Right: Console.In.Read(myChar, 0, 1);&lt;br /&gt;Wrong: Console.In.Read(myChar,0,1); &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;u&gt;Do not&lt;/u&gt; use a space after the parenthesis and function arguments&lt;br /&gt;Right: CreateFoo(myChar, 0, 1)&lt;br /&gt;Wrong: CreateFoo( myChar, 0, 1 ) &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;u&gt;Do not&lt;/u&gt; use spaces between a function name and parenthesis.&lt;br /&gt;Right: CreateFoo()&lt;br /&gt;Wrong: CreateFoo () &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;u&gt;Do not&lt;/u&gt; use spaces inside brackets.&lt;br /&gt;Right: x = dataArray[index];&lt;br /&gt;Wrong: x = dataArray[ index ]; &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;u&gt;Do&lt;/u&gt; use a single space before flow control statements&lt;br /&gt;Right: while (x == y)&lt;br /&gt;Wrong: while(x==y) &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;u&gt;Do&lt;/u&gt; use a single space before and after comparison operators&lt;br /&gt;Right: if (x == y)&lt;br /&gt;Wrong: if (x==y) &lt;/span&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h4&gt;&lt;a name="_Toc6325247"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;6 Naming&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Follow all .NET Framework Design Guidelines for both internal and external members. Highlights of these include:&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;Do not&lt;/b&gt; use Hungarian notation &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;Do not&lt;/b&gt; use a prefix for member variables (_, m_, s_, etc.). If you want to distinguish between local and member variables you should use "this." in C# and "Me." in &lt;a href="http://vb.net/"&gt;VB.NET&lt;/a&gt;. &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;Do&lt;/b&gt; use camelCasing for member variables &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;Do&lt;/b&gt; use camelCasing for parameters &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;Do&lt;/b&gt; use camelCasing for local variables &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;Do &lt;/b&gt;use PascalCasing for function, property, event, and class names &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;Do&lt;/b&gt; prefix interfaces names with "I" &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;Do not&lt;/b&gt; prefix enums, classes, or delegates with any letter &lt;/span&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;The reasons to extend the public rules (no Hungarian, no prefix for member variables, etc.) is to produce a consistent source code appearance. In addition a goal is to have clean readable source. Code legibility should be a primary goal.&lt;i&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;h4&gt;&lt;a name="_Toc6325248"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;7 Naming Conventions&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;&lt;h5&gt;&lt;a name="_Toc6325249"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Interop Classes&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Classes that are there for interop wrappers (DllImport statements) should follow the naming convention below:&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;NativeMethods&lt;/b&gt; – No suppress unmanaged code attribute, these are methods that can be used anywhere because a stack walk will be performed.&lt;b&gt;&lt;/b&gt; &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;UnsafeNativeMethods&lt;/b&gt; – Has suppress unmanaged code attribute. These methods are potentially dangerous and any &lt;i&gt;caller&lt;/i&gt; of these methods must do a full security review to ensure that the usage is safe and protected as no stack walk will be performed.&lt;b&gt;&lt;/b&gt; &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;b&gt;SafeNativeMethods &lt;/b&gt;– Has suppress unmanaged code attribute. These methods are safe and can be used fairly safely and the caller isn't needed to do full security reviews even though no stack walk will be performed.&lt;b&gt;&lt;/b&gt; &lt;/span&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;class NativeMethods&lt;br /&gt;{&lt;br /&gt;private NativeMethods() {}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;[DllImport("user32")]&lt;br /&gt;internal static extern void FormatHardDrive(string driveName);&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;[SuppressUnmanagedCode]&lt;br /&gt;class UnsafeNativeMethods&lt;br /&gt;{&lt;br /&gt;private UnsafeNativeMethods() {}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;[DllImport("user32")]&lt;br /&gt;internal static extern void CreateFile(string fileName);&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;[SuppressUnmanagedCode]&lt;br /&gt;class SafeNativeMethods&lt;br /&gt;{&lt;br /&gt;private SafeNativeMethods() {}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;[DllImport("user32")]&lt;br /&gt;internal static extern void MessageBox(string text);&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;All interop classes &lt;b&gt;must&lt;/b&gt; be private, and all methods must be &lt;b&gt;internal&lt;/b&gt;. In addition a private constructor should be provided to prevent instantiation.&lt;/span&gt;&lt;/p&gt;&lt;h4&gt;&lt;a name="_Toc6325250"&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;8 File Organization&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Source files should contain only one public type, although multiple internal classes are allowed &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Source files should be given the name of the public class in the file &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Directory names should follow the namespace for the class &lt;/span&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;For example, I would expect to find the public class "System.Windows.Forms.Control" in "System\Windows\Forms\Control.cs"…&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Classes member should be &lt;b&gt;alphabetized&lt;/b&gt;, and grouped into sections (Fields, Constructors, Properties, Events, Methods, Private interface implementations, Nested types) &lt;/span&gt;&lt;li&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Using statements should be inside the namespace declaration. &lt;/span&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;namespace MyNamespace&lt;br /&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;using System;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;public class MyClass : IFoo&lt;br /&gt;{&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;// fields&lt;br /&gt;int foo;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;// constructors&lt;br /&gt;public MyClass() { … }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;// properties&lt;br /&gt;public int Foo { get { … } set { … } }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;// events&lt;br /&gt;public event EventHandler FooChanged { add { … } remove { … } }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;// methods&lt;br /&gt;void DoSomething() { … }&lt;br /&gt;void FindSomethind() { … }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;//private interface implementations&lt;br /&gt;void IFoo.DoSomething() { DoSomething(); }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;// nested types&lt;br /&gt;class NestedType { … }&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-715308977203847756?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/715308977203847756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/715308977203847756'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/06/net-coding-guidelines.html' title='.NET Coding Guidelines'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-7419820728201773258</id><published>2008-06-11T21:36:00.001-07:00</published><updated>2008-11-12T23:40:59.768-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Selection in Visual Studio 2008 SP1 RTM (Multiple Control Formatting at it's best]</title><content type='html'>&lt;span style="font-family:verdana,sans-serif;"&gt;Last week, I have installed &lt;strong&gt;Visual Studio 2008 SP1 RTM &lt;/strong&gt;and I am happy to bring a new feature in your knowledge [i.e. multiple selection and alignment operations in Design]. This feature has been introduced in &lt;strong&gt;Visual Studio 2008 SP1 RTM &lt;/strong&gt;and &lt;strong&gt;Visual Web Developer Express 2008 SP1 RTM.&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;I do understand that designing pages using absolute positioning of elements is a tedious task and some people avoids it. However we have to been relying on the functionality that Visual Studio used to provide since VS 2002 and expected feature to stay in subsequent versions.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;But the things are changing rapidly here. In VS 2008 Microsoft Visual Studio Product Group has replaced old IE based designer by a new designer that is shared with Expression Web and is based on former FrontPage technologies. But neither FrontPage nor Expression Web ever had multiple selection functionality in their releases, even Visual Interdev 98 is amongst the same page with these tools, Thus it took us some time to implement the feature in the new code base and it was not yet ready for SP1 Beta release. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Due to time constraints, not all functionality available in VS 2005 will become available in VS 2008 SP1. Here is what will be included:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;1. Multiple selection using Ctrl+Click&lt;br /&gt;2. Primary selection is indicated by white tab&lt;br /&gt;3. Position menu with Absolute and Relative sub items&lt;br /&gt;4. Align, Make Same Size and Order menus commands.&lt;br /&gt;5. Ability to apply property to multiple controls in the Properties window&lt;br /&gt;6. Delete multiple controls&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;Excluded Functionality :&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;1. Ability to drag multiple controls&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana,sans-serif;"&gt;2. Cut/Copy/Paste multiple elements&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;But its an interesting move: look at these pictures.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://2.bp.blogspot.com/_KrOZECSJ9C8/SFCoaqrl0rI/AAAAAAAABus/Jjgdzg6sWOA/s1600-h/pic1.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5210849944954852018" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_KrOZECSJ9C8/SFCoaqrl0rI/AAAAAAAABus/Jjgdzg6sWOA/s320/pic1.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://1.bp.blogspot.com/_KrOZECSJ9C8/SFCoPaGNWoI/AAAAAAAABuk/FYFJo21FmQE/s1600-h/pic1.png"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_KrOZECSJ9C8/SFConc7ZrdI/AAAAAAAABu0/VqlXb1CJKzo/s1600-h/pic2.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5210850164601368018" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_KrOZECSJ9C8/SFConc7ZrdI/AAAAAAAABu0/VqlXb1CJKzo/s400/pic2.png" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-7419820728201773258?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/7419820728201773258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/7419820728201773258'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/06/selection-in-visual-studio-2008-sp1-rtm.html' title='Selection in Visual Studio 2008 SP1 RTM (Multiple Control Formatting at it&apos;s best]'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_KrOZECSJ9C8/SFCoaqrl0rI/AAAAAAAABus/Jjgdzg6sWOA/s72-c/pic1.png' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-4566075485336366445</id><published>2008-06-11T05:19:00.001-07:00</published><updated>2008-06-11T21:02:45.738-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Compact Framework'/><title type='text'>How to Implement, Transparency, Gradients and 3D Glass Effects on .NET Compect Framework.</title><content type='html'>Now mobile application developers can create more user friendly UI with .NET Compect Framework!!!&lt;br /&gt;&lt;br /&gt;With the release of Microsoft® Windows Vista® and new development technologies such as Microsoft Silverlight™, .NET Micro Framework and Microsoft Windows® Presentation Foundation [WPF], expectations of what constitutes an acceptable application user interface on various Microsoft client platforms have never been higher. Since a long this move was expected from Microsoft as the company is aggresively capturing mobile deveolopment market, the Independent Software Vendor (ISV) creating software for Microsoft Windows Mobile® has always had to compete on features and functionality, but increasingly also faces competition on look and feel. Developers creating LOB (Line of Business) Windows Mobile solutions must now consider going beyond the out-of-the-box Windows Forms controls available in the .NET Compact Framework to create more compelling Windows Mobile–based application user interfaces that match the new graphic metaphors introduced in Windows Mobile 6.&lt;br /&gt;&lt;p&gt;Creating controls for .NET Compact Framework–based applications—which includes transparency, gradients, and three-dimensional glass-like appearance—is well within reach today, using existing Microsoft Windows Mobile development tools. This article will demonstrate how to achieve transparency, gradients, and glass effects by extending existing .NET Compact Framework controls and leveraging some powerful native graphics features available in the Windows Mobile operating system.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-4566075485336366445?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/4566075485336366445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/4566075485336366445'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/06/how-to-implement-transparency-gradients.html' title='How to Implement, Transparency, Gradients and 3D Glass Effects on .NET Compect Framework.'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-269732290439969852</id><published>2008-06-01T22:09:00.001-07:00</published><updated>2008-06-01T22:10:43.147-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Microsoft releases ASP.NET MVC [Model-View-Controller] Preview - 3</title><content type='html'>&lt;span class="storybody"&gt;&lt;span class="story"&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;Last week (27th May 2008) , Microsoft released the latest preview version of its model-view-controller (MVC) architecture for Web application frameworks.&lt;br /&gt;&lt;img height="9" alt=" " src="http://www.gcn.com/images/clearpixel.gif" width="1" border="0" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="story"&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;The debut of Version 3 was &lt;/span&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2008/05/27/asp-net-mvc-preview-3-release.aspx"&gt;&lt;u&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;announced&lt;/span&gt;&lt;/u&gt;&lt;/a&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt; Tuesday on the blog of Scott Guthrie, corporate vice president of Microsoft's .NET Developer Division. This version includes many of the changes &lt;/span&gt;&lt;a href="http://weblogs.asp.net/scottgu/archive/2008/04/16/asp-net-mvc-source-refresh-preview.aspx"&gt;&lt;u&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;detailed&lt;/span&gt;&lt;/u&gt;&lt;/a&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt; in a post in April and several new ones, including improvements to the MVC, bug fixes, additions to HTML helper methods and a new URL routing engine that will also "ship in .NET 3.5 SP1 this summer," Guthrie wrote.&lt;br /&gt;&lt;img height="9" alt=" " src="http://www.gcn.com/images/clearpixel.gif" width="1" border="0" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="story"&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;Another improvement he highlighted is a richer URL route mapping offering, including support for new characters.&lt;br /&gt;&lt;img height="9" alt=" " src="http://www.gcn.com/images/clearpixel.gif" width="1" border="0" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="story"&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;Guthrie also commented on changes planned for upcoming versions. "In future preview releases, you'll start to see more improvements higher up the programming model stack in areas [such as] views (HTML helpers, validation helpers, etc.); AJAX; subcontrollers and site composition; deeper log-in, authentication, authorization and caching integration; as well as data scaffolding support," he wrote.&lt;br /&gt;&lt;img height="9" alt=" " src="http://www.gcn.com/images/clearpixel.gif" width="1" border="0" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="story"&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;The preview is available for public download &lt;/span&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&amp;amp;displaylang=en"&gt;&lt;u&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;here&lt;/span&gt;&lt;/u&gt;&lt;/a&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;. The source code is available &lt;/span&gt;&lt;a href="http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=aspnet&amp;amp;ReleaseId=13792"&gt;&lt;u&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;here&lt;/span&gt;&lt;/u&gt;&lt;/a&gt;&lt;span style="font-family:verdana,sans-serif;font-size:85%;"&gt;.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-269732290439969852?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/269732290439969852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/269732290439969852'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/06/microsoft-releases-aspnet-mvc-model.html' title='Microsoft releases ASP.NET MVC [Model-View-Controller] Preview - 3'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-2973137111038785889</id><published>2008-05-27T22:28:00.001-07:00</published><updated>2008-05-27T22:29:42.038-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Microsoft Research - SecPAL (A new authorization language)</title><content type='html'>&lt;p&gt;The development of large-scale, decentralized distributed computing environments has highlighted the need for fine-grained control over trust relationships and delegated access rights. Existing approaches do not fully satisfy these needs. They typically lack precision and/or require an undesirable reliance on centralized administration to be effective. In addition, one finds multiple independent mechanisms, with disparate semantics, being used to manage trust, delegation and authorization. This makes it difficult to understand the effective security in large distributed systems and complicates their management.&lt;/p&gt;&lt;p&gt;The goal of the SecPAL project is to develop a language for expressing decentralized authorization policies, and to investigate language design and semantics, as well as related algorithms and analysis techniques. This project is a collaboration between the advanced technology incubation group of Microsoft's Chief Research and Strategy Officer and &lt;strong&gt;Microsoft Research Cambridge&lt;/strong&gt;.&lt;/p&gt;&lt;br /&gt;Download : &lt;a href="http://research.microsoft.com/research/downloads/Details/81e28b29-10be-4551-9ede-1690f32e1581/Details.aspx"&gt;SecPAL for .NET&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-2973137111038785889?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/2973137111038785889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/2973137111038785889'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/05/microsoft-research-secpal-new.html' title='Microsoft Research - SecPAL (A new authorization language)'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-3941384319647503585</id><published>2008-05-27T05:56:00.000-07:00</published><updated>2008-05-27T05:58:59.553-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><title type='text'>Microsoft Releases ".NET Micro Framework"</title><content type='html'>Microsoft has announced a new release of its .NET Micro Framework platform for low-end embedded processors. Version 2.5 adds a native TCP/IP stack and support for Web Services on Devices (WSD), which aims to allow network-connected devices to discover and connect to one another without user intervention.Networking a .NET MF device previously required calling through to an underlying operating system with sockets support, according to Microsoft. Version 2.5 now provides a stack that is available even when running directly on the hardware. Since device makers need only provide a driver for the network interface, a wider selection of network-capable hardware development platforms will be available, the company says.Microsoft adds that the new version of .NET MF will also include client and server support for &lt;a href="http://www.microsoft.com/whdc/rally/rallyWSondevices.mspx" target="new"&gt;Web Services on Devices&lt;/a&gt;, also known as Device Profile for Web Services (DPWS). Already part of Windows Vista and &lt;a href="http://www.windowsfordevices.com/news/NS5643468769.html" target="new"&gt;Windows CE 6.0 Release 2&lt;/a&gt;, this "enables a USB-like level of plug-and-play for networked devices," in the company's words. DPWS-enabled devices on a network can discover one another, then invoke the functionality each device provides.About .NET Micro Framework Microsoft .NET Micro Framework (.NET MF) in 2006, aiming it at wireless remote controls, watches, and other cost-sensitive devices with constrained processor and memory resources. The .NET MF grew out of Microsoft's &lt;a href="http://www.windowsfordevices.com/articles/AT6914689493.html" target="new"&gt;Smart Personal Objects Technology&lt;/a&gt; (SPOT) initiative, with embryonic versions variously dubbed .NET Embedded and Tiny CLR.According to Microsoft, .NET MF supports low-end embedded processors and doesn't require an MMU (memory management unit). A typical runtime image is only about 300 KB in size, the company says.AvailabilityThe .NET Micro Framework, version 2.5, is available now, according to Microsoft. It is being demonstrated this week at the Embedded Workd 2008 show, in Nuremberg, Germany, in the Microsoft Windows Embedded booth (hall 11, stand 318).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-3941384319647503585?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/3941384319647503585'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/3941384319647503585'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/05/microsoft-releases-net-micro-framework.html' title='Microsoft Releases &quot;.NET Micro Framework&quot;'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-5125350477995022312</id><published>2008-04-22T01:42:00.000-07:00</published><updated>2008-05-27T05:06:29.179-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>ASP.NET 2.0 Page &amp; Control Event Cycle</title><content type='html'>&lt;span style="font-family:verdana;font-size:85%;"&gt;Hi, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Here is the event cycle in ASP.NET 2.0 Page.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Application: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;BeginRequestApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreAuthenticateRequestApplication:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;AuthenticateRequestApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PostAuthenticateRequestApplication:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreAuthorizeRequestApplication&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;AuthorizeRequestApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PostAuthorizeRequestApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreResolveRequestCacheApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;ResolveRequestCacheApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PostResolveRequestCacheApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreMapRequestHandlerPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;ConstructApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PostMapRequestHandlerApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreAcquireRequestStateApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;AcquireRequestStateApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PostAcquireRequestStateApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreRequestHandlerExecutePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;AddParsedSubObjectPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;CreateControlCollectionPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;AddedControlPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;AddParsedSubObjectPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;AddedControlPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;ResolveAdapterPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;DeterminePostBackModePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreInitControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;ResolveAdapterControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;InitControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;TrackViewStatePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;InitPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;TrackViewStatePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;InitCompletePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;LoadPageStateFromPersistenceMediumControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;LoadViewStatePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;EnsureChildControlsPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;CreateChildControlsPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreLoadPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;LoadControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;DataBindControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;LoadPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;EnsureChildControlsPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;LoadCompletePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;EnsureChildControlsPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreRenderControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;EnsureChildControlsControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreRenderPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreRenderCompletePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SaveViewStateControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SaveViewStatePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SaveViewStateControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SaveViewStatePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SavePageStateToPersistenceMediumPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SaveStateCompletePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;CreateHtmlTextWriterPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;RenderControlPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;RenderPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;RenderChildrenControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;RenderControlPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;VerifyRenderingInServerFormPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;CreateHtmlTextWriterControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;UnloadControl: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;DisposePage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;UnloadPage: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;DisposeApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PostRequestHandlerExecuteApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreReleaseRequestStateApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;ReleaseRequestStateApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PostReleaseRequestStateApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreUpdateRequestCacheApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;UpdateRequestCacheApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PostUpdateRequestCacheApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;EndRequestApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreSendRequestHeadersApplication: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PreSendRequestContent&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-5125350477995022312?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/5125350477995022312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/5125350477995022312'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/04/aspnet-20-page-control-event-cycle.html' title='ASP.NET 2.0 Page &amp; Control Event Cycle'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-94199938947363369</id><published>2008-04-02T05:49:00.000-07:00</published><updated>2008-05-27T05:07:56.394-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>The SML.NET compiler</title><content type='html'>&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;u&gt;What is ML?&lt;/u&gt;&lt;br /&gt;ML is a programming language originally developed at the University of Edinburgh around twenty years ago. There are now two variants: Standard ML (also known as SML), which has a formal definition most recently revised in 1997, and O'Caml, developed at INRIA in Paris.&lt;br /&gt;&lt;u&gt;What is ML like?&lt;br /&gt;&lt;/u&gt;ML is a high-level language that abstracts away from the machine so that the programmer doesn't have to worry about low-level details like memory management, data representation and pointer chasing. It therefore has advantages of increased productivity, clearer and more maintainable code, and fewer errors. Its features include:&lt;br /&gt;1. &lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Static type checking and type inference&lt;br /&gt;2. &lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Garbage collection&lt;br /&gt;3. &lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Exception handling&lt;br /&gt;4. Parameterized types and parametric polymorphism&lt;br /&gt;5. Recursive datatypes and pattern matching&lt;br /&gt;6. Mutable references&lt;br /&gt;7. First-class functions&lt;br /&gt;8. Sophisticated module system with parameterized modules&lt;br /&gt;&lt;u&gt;What is ML good for?&lt;br /&gt;&lt;/u&gt;ML is particularly good for language-processing, hence its widespread use amongst the research community in compilers, interpreters, program analysis tools, theorem provers and formal verifiers. But the advantages listed above make it useful for many applications.&lt;br /&gt;&lt;u&gt;What is SML.NET?&lt;/u&gt;&lt;br /&gt;SML.NET is a Standard ML compiler developed at Microsoft Research Cambridge that targets the .NET Common Language Runtime (CLR). It's very easy to use: tell it where your source code lives, give it the name of a "root" structure, and it produces an assembler file which it then runs through the CLR assembler to produce an executable or DLL. The code that it produces is verifiable.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-94199938947363369?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/94199938947363369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/94199938947363369'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/04/smlnet-compiler.html' title='The SML.NET compiler'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-16604161259414878</id><published>2008-04-02T05:34:00.001-07:00</published><updated>2008-05-27T05:08:37.720-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Obfuscation</title><content type='html'>&lt;span style="font-family:verdana;font-size:85%;"&gt;One topic I'm often asked about is obfuscation of managed code, What is that? Is it a new way to secure your assembly/code?. Let me tell you, obfuscation is the process of scrambling the symbols, code, and data of a program to prevent reverse engineering. The technique is also preventing code from the possible security threats.&lt;br /&gt;Optimizing C++ compilers for native code tend to produce obfuscated code by default. In the process of optimizing, the code is often rearranged quite a bit and symbols are stripped from retail builds. In contrast, managed code compilers (C#, VB.NET, etc) generate IL, not native assembly code. This IL tends to be consistently structured and fairly easy to reverse engineer. Most optimization happens when the IL is JIT-compiled into native code, not during compilation.&lt;br /&gt;This means it's pretty easy to take a compiled assembly and de-compile it into source code, using a tool such as Lutz’s Reflector and File Disassembler . While this is a non-issue for web scenarios where all the code resides on the server, it's a big issue for some client scenarios, especially ISV applications. These client applications may contain trade secrets or sensitive information in their algorithms, data structures, or data. This is where obfuscation tools come in.&lt;br /&gt;Obfuscation tools mangle symbols and rearrange code blocks to foil decompiling. They also may encrypt strings containing sensitive data. It's important to understand that obfuscators (as they exist today) can't completely protect your intellectual property. Because the code is on the client machine, a really determined hacker with lots of time can study the code and data structures enough to understand what's going on. Obfuscators do provide value in raising the bar, however, defeating most decompiler tools and preventing the casual hacker from stealing your intellectual property. They can make your code as difficult to reverse engineer as optimize native code.&lt;br /&gt;If you're interested in obfuscation for your code, I recommend taking a look at one of the third-party obfuscators that work on managed code. For example, &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/howtobuy/vs2005/"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Visual Studio&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt; ships with the community edition of &lt;/span&gt;&lt;a href="http://preemptive.com/products/dotfuscator/index.html"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Dotfuscator&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;, a popular obfuscation package. The community edition only mangles symbol names, so it's not doing everything the full-featured editions do, but it will at least give you an idea of how an obfuscator works. And there are other &lt;/span&gt;&lt;a href="http://search.msn.com/results.aspx?q=.NET+obfuscation+software"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;third-party obfuscators&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt; that work on managed code as well. Keep in mind that obfuscating your code may make debugging more difficult or impossible. Many of the third-party obfuscators have features that help with debugging, however, such as keeping a mapping file from obfuscated symbol names to original symbol names.&lt;br /&gt;I'm also asked what is Microsoft's stance on obfuscation? Do MS obfuscate their own code? The answer for the .NET Framework team is no. As a development platform, it makes more sense not to obfuscate, so MS protect their intellectual property by other means. Some Microsoft products that use managed code have opted to obfuscate.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-16604161259414878?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/16604161259414878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/16604161259414878'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/04/obfuscation.html' title='Obfuscation'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-8973134205773497620</id><published>2008-04-02T05:19:00.000-07:00</published><updated>2008-05-27T05:09:08.457-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft Gadgets'/><title type='text'>MS Surface</title><content type='html'>&lt;span style="font-family:verdana;font-size:85%;"&gt;It's lil bit longer then expected, but Microsoft has its first customer ready to put Surface computers into public use.&lt;br /&gt;Perhaps most interestingly, the first one out of the gate is not one of the company's earliest partners. Instead, it is cellular carrier AT&amp;amp;T that is ready to make use of the touch-screen computers. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The company will use several counter-height units inside its cellular retail stores. The company is beginning with five stores on April 17: two in New York, one in San Francisco, one in San Antonio, and one in Atlanta. Each store will have a few of the Surface machines where customers can compare the features of different phones as well as check out service plans and view coverage maps. Currently AT&amp;amp;T uses laptops in the store to offer such features.&lt;br /&gt;"We're in business now," said Pete Thompson, the general manager of Microsoft's surface computing unit.&lt;br /&gt;Microsoft had talked about such a retail use for Surface, but in its demonstrations had featured AT&amp;amp;T rival T-Mobile. Thompson said that T-Mobile remains a partner, but he had no update as to when that carrier will be ready to use Surface in its stores.&lt;br /&gt;And, although Microsoft CEO Steve Ballmer has said he wants the consumer version of surface speed up, Thompson said he also wants to make sure that the company doesn't disappoint its earliest customers, who are all large businesses.&lt;br /&gt;Microsoft has said it is aiming to have the consumer version on shelves by 2011, as much as two years earlier than its initial plan.&lt;br /&gt;"We are trying to do the right thing and accelerate where we can," Thompson said, but added, "I am very much focused on making this initial commercial plan a success without getting distracted."&lt;br /&gt;As for those early buyers, Thompson said that Microsoft does have other unnanounced customers for the Surface, though he declined to name names. (One name we've heard mentioned is Disney, though Thompson would not comment on that.) He did say that we would start to see activity through partners in some additional areas, such as government, health care, and education.&lt;br /&gt;At last year's partner conference, Microsoft talked about having a software development kit available by April.&lt;br /&gt;Thompson said that the company has started offering a development kit for some software makers and partners, but that for the time being the kit will only be available to select developers.&lt;br /&gt;"We're looking at more of a managed rollout of the SDK at this point," he said, adding that he would not characterize the software kit as being broadly available. "That's where we want to get to. I don't want to say this is a closed or managed system over time."&lt;br /&gt;Although AT&amp;amp;T will be the first place the public can go to regularly see the Surface, Microsoft has permanently installed the machines in one other place: its own campus.&lt;br /&gt;"You can just walk into most lobbies," Thompson said, adding that the company has about 15 to 20 buildings with the machines so far. "We're putting in three to five a week."&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-8973134205773497620?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8973134205773497620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8973134205773497620'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/04/ms-surface.html' title='MS Surface'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-4604632923599568113</id><published>2008-04-02T05:12:00.000-07:00</published><updated>2008-05-27T05:09:40.277-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft News'/><title type='text'>Microsoft Wins Open-Format Designation</title><content type='html'>&lt;a title="More information about Microsoft Corporation" href="http://topics.nytimes.com/top/news/business/companies/microsoft_corporation/index.html?inline=nyt-org"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Microsoft&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt; has won an international standards designation for its open-document format, according to voting results obtained Tuesday, apparently ending a divisive yearlong battle with software rivals before a global standards-setting organization.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Microsoft’s Office Open XML, a format for interchangeable Web documents, was approved by 24 of 32 countries in a core group in a ballot by the International Organization for Standardization. Approval by the standards-setting body, a nongovernmental network of 157 countries based in Geneva, is considered almost certain to influence software spending by governments and large companies.&lt;br /&gt;The tally reversed a loss by Microsoft in first-round voting before an 87-nation panel in September, a process that involved blunt lobbying by both sides toward members of national standards committees — typically made up of technicians, engineers and bureaucrats.&lt;br /&gt;In the final round of voting, which ended Saturday, three-quarters of the core group members — including Britain, Japan, Germany and Switzerland — supported Microsoft’s standard, according to the results document. Of the 87 votes, 10 opposed the standard: Brazil, Canada, China, Cuba, Ecuador, India, Iran, New Zealand, South Africa and Venezuela.&lt;br /&gt;Under organization rules, at least 66 percent of core group members must accept a standard for it to be approved, and no more than 25 percent of all voting nations can be opposed.&lt;br /&gt;Roger Frost, a spokesman in Geneva for the standardization group, would not confirm that Microsoft’s format had been designated, saying the organization would disclose the vote Wednesday after informing its members. The International Herald Tribune obtained the results from one of the delegations contacted by the standardization group.&lt;br /&gt;Microsoft’s request for rapid approval of its standard in early 2007 produced an intense lobbying campaign by &lt;/span&gt;&lt;a title="More information about International Business Machines (I.B.M.)" href="http://topics.nytimes.com/top/news/business/companies/international_business_machines/index.html?inline=nyt-org"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;I.B.M.&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt; and &lt;/span&gt;&lt;a title="More information about Sun Microsystems Inc." href="http://topics.nytimes.com/top/news/business/companies/sun_microsystems_inc/index.html?inline=nyt-org"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Sun Microsystems&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;, which had helped develop a rival interchangeable document format called Open Document Format.&lt;br /&gt;This rival was the first interchangeable document format to receive approval by the standardization group in 2006, and its backers used that in selling the technology to governments and large companies. The format is now being considered for use by 70 nations.&lt;br /&gt;Microsoft’s push for speedy approval led to objections from many members of the standards group. They felt pressure from the company, whose Office application suite is the standard on more than 90 percent of computers and archives worldwide, according to International Data in Framingham, Mass.&lt;br /&gt;There were tart remarks even from countries that abstained from the vote, like the Netherlands. “This is like someone with six shopping carts of food trying to go through the express lane at a supermarket,” said Michiel Leenaars, a member of the Dutch delegation. “The end result of this will be confusion. The standard is simply too big. There are still a lot of questions out there.”&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-4604632923599568113?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/4604632923599568113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/4604632923599568113'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2008/04/microsoft-wins-open-format-designation.html' title='Microsoft Wins Open-Format Designation'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-633364346773327453</id><published>2007-09-01T11:12:00.001-07:00</published><updated>2008-11-12T23:41:03.036-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design Patterns'/><title type='text'>Design Patterns</title><content type='html'>&lt;span xmlns=""&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Factory Pattern&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Factory Methods are usually called within Template Methods. Often, designs start out using Factory Method (less complicated, more customizable, subclasses proliferate) and evolve toward Abstract Factory, Prototype, or Builder (more flexible, more complex) as the designer discovers where more flexibility is needed. &lt;strong&gt;Where ever you can implement Factory, you can easily incorporate Abstract Factory and Builder.&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;a href="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtms1yJWUCI/AAAAAAAABn8/tGQ3fPfX5f0/s1600-h/factory.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105301692595195938" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtms1yJWUCI/AAAAAAAABn8/tGQ3fPfX5f0/s320/factory.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Abstract Factory&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Abstract Factory classes are often implemented with Factory Methods, but they can be implemented using Prototype. &lt;strong&gt;Where ever you can implement Abstract Factory, you can easily incorporate Factory and Builder. &lt;/strong&gt;The core difference between Factory and Abstract Factory is, Abstract Factory is useful when application demands Family of objects creation, where as Factory is useful at the time of creation of an single instance of a class.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://3.bp.blogspot.com/_KrOZECSJ9C8/RtmtOSJWUDI/AAAAAAAABoE/f1THzJiUW2U/s1600-h/abs+factory.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105302113501990962" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_KrOZECSJ9C8/RtmtOSJWUDI/AAAAAAAABoE/f1THzJiUW2U/s320/abs+factory.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Builder&lt;/strong&gt;&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Builder focuses on constructing a complex object step by step. Abstract Factory emphasizes a family of product objects (either simple or complex). Builder returns the product as a final step, but as far as the Abstract Factory is concerned, the product gets returned immediately. &lt;strong&gt;Where ever you can implement Builder, you can also implement factory or abstract factory. This can be implement for Abstract Factory and Factory too.&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_KrOZECSJ9C8/RtmxziJWUGI/AAAAAAAABoc/UpnTpeM2rN4/s1600-h/builder.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105307151498629218" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_KrOZECSJ9C8/RtmxziJWUGI/AAAAAAAABoc/UpnTpeM2rN4/s320/builder.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Prototype&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Factory Method: creation through inheritance. Prototype: creation through delegation. In .NET one can easily incorporate prototype using&lt;strong&gt; "Icloneabe--&amp;gt; Clone"&lt;/strong&gt;. Prototype is useful when you want to create new object without firing object's constructor. In .NET framework there are two ways to create object without calling constructor (Cloning and De-serialization).&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_KrOZECSJ9C8/RtmyjSJWUHI/AAAAAAAABok/CMhiosm1en4/s1600-h/prototype.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105307971837382770" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_KrOZECSJ9C8/RtmyjSJWUHI/AAAAAAAABok/CMhiosm1en4/s320/prototype.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Adapter&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Adapter makes things work after they're designed; Bridge makes them work before they are. Bridge is designed up-front to let the abstraction and the implementation vary independently. Adapter is retrofitted to make unrelated classes work together.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtmz4SJWUKI/AAAAAAAABo8/SMZh4l0RYSQ/s1600-h/adapter.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105309432126263458" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtmz4SJWUKI/AAAAAAAABo8/SMZh4l0RYSQ/s320/adapter.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;a href="http://2.bp.blogspot.com/_KrOZECSJ9C8/RtmzSCJWUJI/AAAAAAAABo0/3W3n8OflPDo/s1600-h/prototype.jpg"&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Bridge&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The structure of State and Bridge are identical (except that Bridge admits hierarchies of envelope classes, whereas State allows only one). The two patterns use the same structure to solve different problems: State allows an object's behavior to change along with its state, while Bridge's intent is to decouple an abstraction from its implementation so that the two can vary independently.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm0GSJWULI/AAAAAAAABpE/m3vw1WL2R4Q/s1600-h/bridge.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105309672644432050" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm0GSJWULI/AAAAAAAABpE/m3vw1WL2R4Q/s320/bridge.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Composite&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Three GoF patterns rely on recursive composition: Composite, Decorator, and Chain of Responsibility&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtm0SyJWUMI/AAAAAAAABpM/rZidpbgKNno/s1600-h/Composite.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105309887392796866" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtm0SyJWUMI/AAAAAAAABpM/rZidpbgKNno/s320/Composite.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Decorator&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Decorator is designed to let you add responsibilities to objects without subclassing. Composite's focus is not on embellishment but on representation. These intents are distinct but complementary. Consequently, Composite and Decorator are often used in concert.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm05SJWUNI/AAAAAAAABpU/_uv1n7euvdM/s1600-h/decorator.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105310548817760466" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm05SJWUNI/AAAAAAAABpU/_uv1n7euvdM/s320/decorator.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Façade&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Facade defines a new interface, whereas Adapter uses an old interface. Remember that Adapter makes two existing interfaces work together as opposed to defining an entirely new one.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm05SJWUOI/AAAAAAAABpc/a06Nmur766E/s1600-h/facade.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105310548817760482" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm05SJWUOI/AAAAAAAABpc/a06Nmur766E/s320/facade.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Flyweight&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Flyweight is often combined with Composite to implement shared leaf nodes. Flyweight shows how to make lots of little objects. Facade shows how to make a single object represent an entire subsystem. This diagram is perhaps a better example of Composite than the Composite diagram.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm05iJWUPI/AAAAAAAABpk/NP6l9OQesJo/s1600-h/flyweight.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105310553112727794" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm05iJWUPI/AAAAAAAABpk/NP6l9OQesJo/s320/flyweight.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Proxy&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Decorator and Proxy have different purposes but similar structures. Both describe how to provide a level of indirection to another object, and the implementations keep a reference to the object to which they forward requests. Adapter provides a different interface to its subject. Proxy provides the same interface. Decorator provides an enhanced interface.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtm1uyJWUQI/AAAAAAAABps/7nWgKRUNHlU/s1600-h/proxy.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105311467940761858" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtm1uyJWUQI/AAAAAAAABps/7nWgKRUNHlU/s320/proxy.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Chain of Resp.&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Chain of Responsibility, Command, Mediator, and Observer, address how you can decouple senders and receivers, but with different trade-offs. Chain of Responsibility passes a sender request along a chain of potential receivers.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm1vSJWURI/AAAAAAAABp0/EJrN_lqQ2JE/s1600-h/cor.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105311476530696466" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm1vSJWURI/AAAAAAAABp0/EJrN_lqQ2JE/s320/cor.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Command&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Command and Memento act as magic tokens to be passed around and invoked at a later time. In Command, the token represents a request; in Memento, it represents the internal state of an object at a particular time. Polymorphism is important to Command, but not to Memento because its interface is so narrow that a memento can only be passed as a value.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm1vSJWUSI/AAAAAAAABp8/-xnzQ1DPmTg/s1600-h/command.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105311476530696482" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm1vSJWUSI/AAAAAAAABp8/-xnzQ1DPmTg/s320/command.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Interpreter&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Interpreter is really an application of Composite.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm1viJWUTI/AAAAAAAABqE/PE3vLSHZUVE/s1600-h/interpreter.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105311480825663794" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm1viJWUTI/AAAAAAAABqE/PE3vLSHZUVE/s320/interpreter.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Iterator&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Memento is often used in conjunction with Iterator. An Iterator can use a Memento to capture the state of an iteration. The Iterator stores the Memento internally.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm1viJWUUI/AAAAAAAABqM/JYl3_NH6v7E/s1600-h/iterator.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105311480825663810" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm1viJWUUI/AAAAAAAABqM/JYl3_NH6v7E/s320/iterator.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Mediator&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Mediator is similar to Facade in that it abstracts functionality of existing classes. Mediator abstracts/centralizes arbitrary communications between colleague objects. It routinely "adds value", and it is known/referenced by the colleague objects. In contrast, Facade defines a simpler interface to a subsystem, it doesn't add new functionality, and it is not known by the subsystem classes.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NCJWUVI/AAAAAAAABqU/wPpV7-GWW4M/s1600-h/mediator.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105313087143432530" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NCJWUVI/AAAAAAAABqU/wPpV7-GWW4M/s320/mediator.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Memento&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Command can use Memento to maintain the state required for an undo operation.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NCJWUWI/AAAAAAAABqc/TKnGC6CVhso/s1600-h/memento.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105313087143432546" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NCJWUWI/AAAAAAAABqc/TKnGC6CVhso/s320/memento.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Observer&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Mediator and Observer are competing patterns. The difference between them is that Observer distributes communication by introducing "observer" and "subject" objects, whereas a Mediator object encapsulates the communication between other objects. We've found it easier to make reusable Observers and Subjects than to make reusable Mediators. On the other hand, Mediator can leverage Observer for dynamically registering colleagues and communicating with them.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NSJWUXI/AAAAAAAABqk/zAPqNrvd1-8/s1600-h/observer.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105313091438399858" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NSJWUXI/AAAAAAAABqk/zAPqNrvd1-8/s320/observer.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Strategy&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Strategy, State, Bridge (and to some degree Adapter) have similar solution structures. They all share elements of the "handle/body" idiom. They differ in intent - that is, they solve different problems.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Most of the GoF patterns exercise the two levels of indirection demonstrated here.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Promote the "interface" of a method to an abstract base class or interface, and bury the many possible implementation choices in concrete derived classes.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Hide the implementation hierarchy behind a "wrapper" class that can perform responsibilities like: choosing the best implementation, caching, state management, remote access.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Strategy can be considered as a mother of all pattern.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NiJWUYI/AAAAAAAABqs/irRthJ65AUk/s1600-h/STRATEGY.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105313095733367170" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NiJWUYI/AAAAAAAABqs/irRthJ65AUk/s320/STRATEGY.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;State&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Strategy is a bind-once pattern, whereas State is more dynamic.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NiJWUZI/AAAAAAAABq0/dZGyCdzY_yQ/s1600-h/state.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105313095733367186" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_KrOZECSJ9C8/Rtm3NiJWUZI/AAAAAAAABq0/dZGyCdzY_yQ/s320/state.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Template Method&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Template Method uses inheritance to vary part of an algorithm. Strategy uses delegation to vary the entire algorithm.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtm35yJWUaI/AAAAAAAABq8/mgoQLm-2xeU/s1600-h/template.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105313855942578594" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtm35yJWUaI/AAAAAAAABq8/mgoQLm-2xeU/s320/template.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;Visitor&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The Visitor pattern is the classic technique for recovering lost type information without resorting to dynamic casts.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtm35yJWUbI/AAAAAAAABrE/FGFlesNZhHs/s1600-h/visitor.jpg"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5105313855942578610" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtm35yJWUbI/AAAAAAAABrE/FGFlesNZhHs/s320/visitor.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="TEXT-DECORATION: underline"&gt;&lt;strong&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;ol&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/ol&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-633364346773327453?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/633364346773327453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/633364346773327453'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2007/09/design-patterns.html' title='Design Patterns'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_KrOZECSJ9C8/Rtms1yJWUCI/AAAAAAAABn8/tGQ3fPfX5f0/s72-c/factory.jpg' height='72' width='72'/></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-3627625966210955413</id><published>2007-05-18T04:29:00.000-07:00</published><updated>2007-05-18T04:36:48.624-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>How to avoid GC-Hole</title><content type='html'>&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;To avoid GC-Hole one must use GCPROTECT_BEGIN to keep your references up to date.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Here’s how to fix our buggy code fragment.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;#include “frames.h”&lt;br /&gt;{&lt;br /&gt;MethodTable *pNT = g_pObjectClass-&gt;GetRefTable();&lt;br /&gt;&lt;br /&gt;//RIGHT&lt;br /&gt;OBJECTREF a = AllocateObjectMemory(pNT);&lt;br /&gt;&lt;br /&gt;GCPROTECT_BEGIN(a);&lt;br /&gt;OBJECTREF b = AllocateObjectMemory(pNT);&lt;br /&gt;&lt;br /&gt;DoSomething (a, b);&lt;br /&gt;&lt;br /&gt;GCPROTECT_END();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Notice the addition of the line GCPROTECT_BEGIN(a). GCPROTECT_BEGIN is a macro whose argument is any OBJECTREF-typed storage location (it has to be an expression that can you can legally apply the address-of (&amp;amp;) operator to.) GCPROTECT_BEGIN tells the GC two things:&lt;br /&gt;&lt;br /&gt;1. The GC is not to discard any object referred to by the reference stored in local “a”.&lt;br /&gt;2. If the GC moves the object referred to by “a”, it must update “a” to point to the new location.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, if the second AllocateObjectMemory() triggers a GC, the “a” object will still be around afterwards, and the local variable “a” will still point to it. “a” may not contain the same address as before, but it will point to the same object. Hence, DoSomething() receives the correct data.&lt;br /&gt;&lt;br /&gt;Note that we didn’t similarly protect ‘b” because the caller has no use for “b” after DoSomething() returns. Furthermore, there’s no point in keeping “b” updated because DoSomething() receives a copy of the reference (don’t confuse with “copy of the object.”), not the reference itself. If DoSomething() internally causes GC as well, it is DoSomething()’s responsibility to protect its own copies of “a” and “b”.&lt;br /&gt;&lt;br /&gt;Having said that, no one should complain if you play it safe and GCPROTECT “b” as well. You never know when someone might add code later that makes the protection necessary.&lt;br /&gt;&lt;br /&gt;Every GCPROTECT_BEGIN must have a matching GCPROTECT_END, which terminates “a”’s protected status. As an additional safeguard, GCPROTECT_END overwrites “a” with garbage so that any attempt to use “a” afterward will fault. GCPROTECT_BEGIN introduces a new C scoping level that GCPROTECT_END closes, so if you use one without the other, you’ll probably experience severe build errors.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Don’t do nonlocal returns from within GCPROTECT blocks.&lt;br /&gt;&lt;br /&gt;Never do a “return”, “goto” or other non-local return from between a GCPROTECT_BEGIN/END pair. This will leave the thread’s frame chain corrupted.&lt;br /&gt;&lt;br /&gt;One exception: it is explicitly allowed to leave a GCPROTECT block by throwing a managed exception (usually via the COMPlusThrow() function.) The exception subsystem knows about GCPROTECT and correctly fixes up the frame chain as it unwinds.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-3627625966210955413?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/3627625966210955413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/3627625966210955413'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2007/05/how-to-avoid-gc-hole.html' title='How to avoid GC-Hole'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-1068620158662213964</id><published>2007-04-09T12:36:00.000-07:00</published><updated>2007-04-09T12:45:36.775-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>What is GC-Hole? And How to create GC-Hole?</title><content type='html'>The term “GC-hole” points to a special class of bugs that bedevils the CLR. The GC hole is a pernicious bug because it is easy to introduce by accident, repros rarely and is very tedious to debug. A single GC-hole can suck up weeks of dev and test time.&lt;br /&gt;&lt;br /&gt;Lets discuss, What is GC-Hole? And How to create it?&lt;br /&gt;&lt;br /&gt;First, some background. One of the major features of the CLR is the Garbage Collection system. That means that allocated objects, as seen by a managed application, are never freed explicitly by the programmer. Instead, the CLR periodically runs a Garbage Collector (GC). The GC discards objects that are no longer in use. Also, the GC compacts the heap to avoid unused holes in memory. Therefore, a managed object does not have a fixed address. Objects move around according to the whims of the garbage collector.&lt;br /&gt;&lt;br /&gt;To do its job, the GC must be told about every reference to every GC object. The GC must know about every stack location, every register and every non-GC data structure that holds a pointer to a GC object. These external pointers are called “root references.”&lt;br /&gt;&lt;br /&gt;Armed with this information, the GC can find all objects directly referenced from outside the GC heap. These objects may in turn, reference other objects – which in turn reference other objects and so on. By following these references, the GC finds all reachable (“live”) objects. All other objects are, by definition, unreachable and therefore discarded. After that, the GC may move the surviving objects to reduce memory fragmentation. If it does this, it must, of course, update all existing references to the moved object.&lt;br /&gt;&lt;br /&gt;Any time a new object is allocated, a GC may occur. GC can also be explicitly requested by calling the GarbageCollect function directly. GC’s do not happen asynchronously outside these events but since other running threads can trigger GC’s, your thread must act as if GC’s are aynchronous unless you take specific steps to synchronize with the GC. More on that later.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So now, we can define a GC hole. A GC hole occurs when code inside the CLR creates a reference to a GC object, neglects to tell the GC about that reference, performs some operation that directly or indirectly triggers a GC, then tries to use the original reference. At this point, the reference points to garbage memory and the CLR will either read out a wrong value or corrupt whatever that reference is pointing to.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The code snippet below is the simplest way to introduce a GC hole into the system.&lt;br /&gt;&lt;br /&gt;//OBJECTREF is a typedef for Object*.&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;PointerTable *pTBL = o_pObjectClass-&gt;GetPointerTable();&lt;br /&gt;&lt;br /&gt;OBJECTREF aObj = AllocateObjectMemory(pTBL);&lt;br /&gt;OBJECTREF bObj = AllocateObjectMemory(pTBL);&lt;br /&gt;&lt;br /&gt;//WRONG!!! “aObj” may point to garbage if the second&lt;br /&gt;//“AllocateObjectMemory” triggered a GC.&lt;br /&gt;DoSomething (aOb, bObj);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;All it does is allocate two managed objects, and then does something with them both.&lt;br /&gt;&lt;br /&gt;This code compiles fine, and if you run simple pre-checkin tests, it will probably “work.” But this code will crash eventually.&lt;br /&gt;&lt;br /&gt;Why? If the second call to “AllocateObjectMemory” triggers a GC, that GC discards the object instance you just assigned to “aObj”. This code, like all C++ code inside the CLR, is compiled by a non-managed compiler and the GC cannot know that “aObj” holds a root reference to an object you want kept live.&lt;br /&gt;&lt;br /&gt;This point is worth repeating. The GC has no intrinsic knowledge of root references stored in local variables or non-GC data structures maintained by the CLR itself. You must explicitly tell the GC about them.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-1068620158662213964?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/1068620158662213964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/1068620158662213964'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2007/04/what-is-gc-hole-and-how-to-create-gc.html' title='What is GC-Hole? And How to create GC-Hole?'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-8920672914322051878</id><published>2007-03-30T02:06:00.000-07:00</published><updated>2007-03-30T02:14:11.700-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Small but interesting thing about .NET Framework 2.0</title><content type='html'>&lt;span style="font-family:verdana;font-size:85%;"&gt;We always talk about the .NET Framework 2.0 the pros and cons, the scope, patterns, best practice and some of the basic class lib.  But are we aware about how many types .NET Framework 2.0 have? And like this only some other basic information? I am sure we are not. So here are the small information I want to share with you.&lt;br /&gt;&lt;br /&gt;Microsoft .NET Framework 2.0 includes &lt;strong&gt;&lt;u&gt;51 assemblies&lt;/u&gt;&lt;/strong&gt;.&lt;br /&gt;Microsoft .NET Framework 2.0 is having &lt;strong&gt;&lt;u&gt;18,619 Types&lt;/u&gt;&lt;/strong&gt;.&lt;br /&gt;Microsoft .NET Framework 2.0 is having &lt;strong&gt;&lt;u&gt;12,909 Classes&lt;/u&gt;&lt;/strong&gt;.&lt;br /&gt;Microsoft .NET Framework 2.0 is having &lt;strong&gt;&lt;u&gt;4,01,758 public methods&lt;/u&gt;&lt;/strong&gt;.&lt;br /&gt;Microsoft .NET Framework 2.0 is having &lt;strong&gt;&lt;u&gt;93,105 public properties&lt;/u&gt;&lt;/strong&gt;.&lt;br /&gt;Microsoft .NET Framework 2.0 is having &lt;strong&gt;&lt;u&gt;30,546 public events&lt;/u&gt;&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;How many of events do we know or used?&lt;br /&gt;How many of types we have used in our n-tire career .NET Dev. Career?&lt;br /&gt;How many methods we used so far?&lt;br /&gt;No question about public events. &lt;br /&gt;&lt;br /&gt;A research says if a person dedicatedly work on .NET 2.0 to use all of the above, he/she might take more then 1 man years to complete this task. And .NET 4 is about to release in next Jan [this is my assumption, nothing declare till now about .net 4.0] or so. So guys start exploring this version more and more.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-8920672914322051878?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8920672914322051878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/8920672914322051878'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2007/03/small-but-interesting-thing-about-net.html' title='Small but interesting thing about .NET Framework 2.0'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-113920722385190718</id><published>2006-02-05T22:17:00.000-08:00</published><updated>2008-05-27T05:11:01.834-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Decode ASP.NET Page's ViewState</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;About LosFormatter&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;Serializes the view state for a Web Forms page. This class cannot be inherited.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The limited object serialization (LOS) formatter is designed for highly compact ASCII format serialization. This class supports serializing any object graph, but is optimized for those containing strings, arrays, and hashtables. It offers second order optimization for many of the .NET primitive types.&lt;br /&gt;This is a private format, and only needs to remain consistent for the lifetime of a Web request. You are not allowed to persist objects serialized with this formatter for any significant length of time.&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;LosFormatter, a member of the System.Web.UI namespace, is a "stripped down" version of BinaryFormatter that is used internally by the ASP.NET runtime to create and retrieve Page - level objects to / from the hidden _VIEWSTATE field.&lt;br /&gt;LosFormatter, although &lt;strong&gt;undocumented&lt;/strong&gt;, can also be easily used explicitly by the developer. One of the handy features it has is that the serialized string it generates is automatically Base64 encoded so that the ViewState Collection can be persisted through page POSTs. Of course, if you explicitly call the methods of LosFormatter, you are not restricted to keeping the resulting string in the hidden _VIEWSTATE field - you can do whatever you want with it.&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;strong&gt;Code To Decode Your ViewState :)&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;System.Web.UI.Triplet _triplet = null;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;try&lt;br /&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;if (txt1.Text!="")&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;LosFormatter _losFormatter = new LosFormatter();&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;System.IO.StringReader _reader= new System.IO.StringReader(txt1.Text);&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;object _deSerialized = _losFormatter.Deserialize(_reader);&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;_triplet = _deSerialized as Triplet;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;ArrayList _Keys = (((_triplet.Second) as Triplet).First as Pair).First as ArrayList;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;ArrayList _Values = (((_triplet.Second) as Triplet).First as Pair).Second as ArrayList;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;txt2.Text = "Decoded Values";&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;txt2.Text = "No. Of Item/s Found : " + _Keys.Count.ToString();&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;for (int _keysCount =0;_keysCount&lt;=_Keys.Count-1;_keysCount++)&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;txt2.Text +="\r\n" + "Key : " + _Keys[_keysCount].ToString() + "\r\n Value : " + _Values[_keysCount].ToString();&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;catch(Exception _ex)&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;throw _ex;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;color:#3366ff;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-113920722385190718?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/113920722385190718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/113920722385190718'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2006/02/decode-aspnet-pages-viewstate.html' title='Decode ASP.NET Page&apos;s ViewState'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-113636576588628654</id><published>2006-01-04T01:04:00.000-08:00</published><updated>2008-05-27T05:11:37.318-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='My Exam Scores'/><title type='text'>My Exam Score [Design Pattern]</title><content type='html'>&lt;a href="http://photos1.blogger.com/blogger/470/977/1600/myImg.gif"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/470/977/400/myImg.jpg" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-113636576588628654?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/113636576588628654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/113636576588628654'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2006/01/my-exam-score-design-pattern.html' title='My Exam Score [Design Pattern]'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-113531275423701243</id><published>2005-12-22T20:37:00.000-08:00</published><updated>2008-05-27T05:12:13.772-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>String Vs StringBuilder : Kaushal Patel</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Introduction&lt;/strong&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;This is my second article regarding performance. Most of the people use string everywhere in their code. Actually when doing string concatenation, do you know what exactly your doing? It has a big drawback mainly in concatenation which can be overcome by StringBuilder. It will give vast improvement in performance when you use concatenation of string over String.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the exact difference?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;First we will look at what happens when you concatenate two strings. For a rough idea, think like this. In a loop you are adding few numbers to get a string to give all the numbers.&lt;br /&gt;&lt;br /&gt;string returnNumber = "";&lt;br /&gt;for(int i = 0; i&lt;1000;i++)&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;returnNumber = returnNumber + i.ToString(); &lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Here we are defining a string called returnNumber and after that in the loop we are concatenating the old one with the new to get a string. Do you know when we do like that we are assigning it again and again? I mean its really like assigning 999 new strings! Actually the concatenation will create a new string returnNumber, with both old returnNumber and i.ToString(). If we think roughly, How will be the performance of the code? Can you imagine it? No one things about this when coding. If we can have something which are be defined only once and add all the strings into it, what can you say about the performance. That's what StringBuilder is doing. &lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;StringBuilder returnNumber = new StringBuilder(10000); &lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;for(int i = 0; i&lt;1000;i++)&lt;/div&gt;&lt;div align="justify"&gt;{ &lt;/div&gt;&lt;div align="justify"&gt;returnNumber.Append(i.ToString()); &lt;/div&gt;&lt;div align="justify"&gt;} &lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;We are creating a StringBuilder of length 10000 in memory where we can add all the strings. Which surely wont create a new string each and every time. Actually we are creating a StringBinder, where whenever something added it will get copied in to that memory area. At the end we can get the string by StringBuilder.ToString(). Here also it wont create a new string. It will return a string instance that will point to the string inside the StringBuilder. See, How efficient this is? To explain this with some practical I'm not going to analyze IL code or Optimized JIT compiled code. You can see the different by running the samples. &lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;Why string? Can't use StringBinder everywhere? &lt;/strong&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div align="justify"&gt;No. You can't. When initializing a StringBuilder you are going down in performance. Also many actions that you do with string can't be done with StringBinder. Actually it is used mostly for situations as explained above. Last week I show a person, who used StringBuilder to just add two strings together! its really nonsense. We must really think about the overhead of initialization. In my personal experience a StringBuilder can be used where more than four or more string concatenation take place. Also if you try to do some other manipulation (Like removing a part from the string, replacing a part in the string, etc, etc) then better not to use StringBuilder at those places. Because anyway we are creating new strings. Another important issue. We must be careful to guess the size of StringBuilder . If the size which we are going to get is more than what assigned, it must increase the size. Which will reduce the performance of it. &lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-113531275423701243?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/113531275423701243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/113531275423701243'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/12/string-vs-stringbuilder-kaushal-patel.html' title='String Vs StringBuilder : Kaushal Patel'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-113143183802759868</id><published>2005-11-07T22:15:00.000-08:00</published><updated>2008-05-27T05:13:12.167-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>My Exams Score Board @ BrainBench</title><content type='html'>&lt;table id="Table1" cellspacing="0" cellpadding="0" border="0" name="popuptable"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tbody&gt;&lt;tr&gt;&lt;p&gt;&lt;br /&gt;1. .NET Framework &lt;p&gt;&lt;/p&gt;&lt;p&gt;2. OO Design Patterns&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td name="bodytext"&gt;&lt;br /&gt;&lt;br /&gt;&lt;table id="Table2" cellspacing="0" cellpadding="5" width="500" align="center" border="1"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tbody&gt;&lt;tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td colspan="2"&gt;&lt;table id="Table3" cellspacing="0" cellpadding="5" width="100%" border="0"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tbody&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="bigtext" align="middle" colspan="2"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;kaushal patel&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="bigtext"&gt;&lt;b&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Test:&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;.NET Framework&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="bigtext"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Date: &lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;08-Nov-2005&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="bigtext"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Score: &lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;3.11&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="bigtext"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Correct/Total: &lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(25/40)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr class="rowheader" valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="headerFont" valign="top" align="middle" width="70%"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Topics/Subtopics&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="headerFont" align="middle"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Correct/Total&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"    style="font-family:verdana;font-size:85%;color:#000000;"&gt;.NET Programming&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;(5/7)&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Features/Benefits&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Attribute Programming&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(2/3)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Security&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/2)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;COM+ Services&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"    style="font-family:verdana;font-size:85%;color:#000000;"&gt;Common Language&lt;br /&gt;Runtime (CLR) &lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;(3/8)&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Virtual Execution Engine (VEE)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Features/Benefits&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/3)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Compilers and Tools&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(0/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Runtime Hosts&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(0/2)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Automatic Memory Management (Garbage Collection)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"    style="font-family:verdana;font-size:85%;color:#000000;"&gt;Assemblies&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;(3/7)&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;.NET Portable Executable (PE) File&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/3)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Assembly Types&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(0/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Versioning&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/2)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Manifests/MSIL&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"    style="font-family:verdana;font-size:85%;color:#000000;"&gt;.NET Architectural&lt;br /&gt;Overview &lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;(5/6)&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Features/Benefits&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(2/2)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Common Language Specification&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Application Domains&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Deployment Strategies&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(0/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;.NET Utilities/Tools&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"    style="font-family:verdana;font-size:85%;color:#000000;"&gt;Common Type System&lt;br /&gt;(CTS) &lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;(4/5)&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Reference Types&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(2/2)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Value Types&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Tables and Heaps&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Common Language Specification&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(0/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"    style="font-family:verdana;font-size:85%;color:#000000;"&gt;.NET Metadata&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;(1/3)&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Benefits/Features&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(1/2)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Inspecting and Emitting&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(0/1)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"    style="font-family:verdana;font-size:85%;color:#000000;"&gt;.NET Framework Class&lt;br /&gt;Library &lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;(4/4)&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Features/Benefits&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(2/2)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Data Classes&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="body" align="middle"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;(2/2)&lt;br /&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt; &lt;/p&gt;&lt;br /&gt;&lt;div align="center"&gt;&lt;br /&gt;&lt;table id="Table1" cellspacing="0" cellpadding="0" border="0" name="popuptable"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;td align="left" name="header"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td name="bodytext"&gt;&lt;br /&gt;&lt;br /&gt;&lt;table id="Table2" cellspacing="0" cellpadding="5" width="500" align="center" border="1"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;td colspan="2"&gt;&lt;br /&gt;&lt;table id="Table3" cellspacing="0" cellpadding="5" width="100%" border="0"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="bigtext" align="middle" colspan="2"&gt;&lt;b&gt;kaushal patel&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="bigtext"&gt;&lt;b&gt;Test:&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body"&gt;OO Design Patterns&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="bigtext"&gt;&lt;b&gt;Date: &lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body"&gt;08-Nov-2005&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="bigtext"&gt;&lt;b&gt;Score: &lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body"&gt;2.93&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="bigtext"&gt;&lt;b&gt;Correct/Total: &lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body"&gt;(21/40)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr class="rowheader" valign="top"&gt;&lt;br /&gt;&lt;td class="headerFont" valign="top" align="middle" width="70%"&gt;&lt;b&gt;Topics/Subtopics&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="headerFont" align="middle"&gt;&lt;b&gt;Correct/Total&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"  style="color:#000000;"&gt;Language Specific&lt;br /&gt;Patterns &lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;&lt;b&gt;(2/10)&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;Java&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(2/8)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;C++&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(0/2)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"  style="color:#000000;"&gt;GoF Patterns&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;&lt;b&gt;(14/22)&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;Behavioral&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(4/8)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;Structural&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(8/9)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;Creational&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(2/5)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"  style="color:#000000;"&gt;Persistence Patterns&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;&lt;b&gt;(1/2)&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;Serialization&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(1/1)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;Object/Relational Mapping&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(0/1)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"  style="color:#000000;"&gt;Fundamental&lt;br /&gt;Architectural Patterns &lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;&lt;b&gt;(2/3)&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;MVC&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(1/2)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;Layering&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(1/1)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td&gt;&lt;b&gt;&lt;span class="body"  style="color:#000000;"&gt;Distributed Patterns&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;&lt;b&gt;(2/3)&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;Design&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(1/1)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr valign="top"&gt;&lt;br /&gt;&lt;td class="body"&gt;Architectural&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td class="body" align="middle"&gt;(1/2)&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="button" align="middle" name="close_button"&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td class="news" align="middle" name="footer"&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-113143183802759868?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/113143183802759868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/113143183802759868'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/11/my-exams-score-board-brainbench.html' title='My Exams Score Board @ BrainBench'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112973211573831530</id><published>2005-10-19T07:23:00.000-07:00</published><updated>2008-05-27T05:14:15.114-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Garbage Collection in .NET : Kaushal</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Implementing proper resource management for your applications can be a difficult, tedious task. It can distract your concentration from the real problems that you're trying to solve. Wouldn't it be wonderful if some mechanism existed that simplified the mind-numbing task of memory management for the developer? Fortunately, in .NET there is: garbage collection (GC).&lt;br /&gt;Let's back up a minute. Every program uses resources of one sort or another—memory buffers, screen space, network connections, database resources, and so on. In fact, in an object-oriented environment, every type identifies some resource available for your program's use. To use any of these resources requires that memory be allocated to represent the type. The steps required to access a resource are as follows:&lt;br /&gt;&lt;br /&gt;1. Allocate memory for the type that represents the resource.&lt;br /&gt;&lt;br /&gt;2. Initialize the memory to set the initial state of the resource and to make the resource usable.&lt;br /&gt;&lt;br /&gt;3. Use the resource by accessing the instance members of the type (repeat as necessary).&lt;br /&gt;&lt;br /&gt;4. Tear down the state of the resource to clean up.&lt;br /&gt;&lt;br /&gt;5. Free the memory.&lt;br /&gt;&lt;br /&gt;This seemingly simple paradigm has been one of the major sources of programming errors. After all, how many times have you forgotten to free memory when it is no longer needed or attempted to use memory after you've already freed it?&lt;br /&gt;These two bugs are worse than most other application bugs because what the consequences will be and when those consequences will occur are typically unpredictable. For other bugs, when you see your application misbehaving, you just fix it. But these two bugs cause resource leaks (memory consumption) and object corruption (destabilization), making your application perform in unpredictable ways at unpredictable times. In fact, there are many tools (such as the Task Manager, the System Monitor ActiveX® Control, CompuWare's BoundsChecker, and Rational's Purify) that are specifically designed to help developers locate these types of bugs.&lt;br /&gt;As I examine GC, you'll notice that it completely absolves the developer from tracking memory usage and knowing when to free memory. However, the garbage collector doesn't know anything about the resource represented by the type in memory. This means that a garbage collector can't know how to perform step four—tearing down the state of a resource. To get a resource to clean up properly, the developer must write code that knows how to properly clean up a resource. In the .NET Framework, the developer writes this code in a Close, Dispose, or Finalize method, which I'll describe later. However, as you'll see later, the garbage collector can determine when to call this method automatically.&lt;br /&gt;Also, many types represent resources that do not require any cleanup. For example, a Rectangle resource can be completely cleaned up simply by destroying the left, right, width, and height fields maintained in the type's memory. On the other hand, a type that represents a file resource or a network connection resource will require the execution of some explicit clean up code when the resource is to be destroyed. I will explain how to accomplish all of this properly. For now, let's examine how memory is allocated and how resources are initialized.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Resource Allocation&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The Microsoft® .NET common language runtime requires that all resources be allocated from the managed heap. This is similar to a C-runtime heap except that you never free objects from the managed heap—objects are automatically freed when they are no longer needed by the application. This, of course, raises the question: how does the managed heap know when an object is no longer in use by the application? I will address this question shortly.&lt;br /&gt;There are several GC algorithms in use today. Each algorithm is fine-tuned for a particular environment in order to provide the best performance. This article concentrates on the GC algorithm that is used by the common language runtime. Let's start with the basic concepts.&lt;br /&gt;When a process is initialized, the runtime reserves a contiguous region of address space that initially has no storage allocated for it. This address space region is the managed heap. The heap also maintains a pointer, which I'll call the NextObjPtr. This pointer indicates where the next object is to be allocated within the heap. Initially, the NextObjPtr is set to the base address of the reserved address space region.&lt;br /&gt;An application creates an object using the new operator. This operator first makes sure that the bytes required by the new object fit in the reserved region (committing storage if necessary). If the object fits, then NextObjPtr points to the object in the heap, this object's constructor is called, and the new operator returns the address of the object.&lt;br /&gt;&lt;br /&gt;At this point, NextObjPtr is incremented past the object so that it points to where the next object will be placed in the heap. Figure 1 shows a managed heap consisting of three objects: A, B, and C. The next object to be allocated will be placed where NextObjPtr points (immediately after object C).&lt;br /&gt;Now let's look at how the C-runtime heap allocates memory. In a C-runtime heap, allocating memory for an object requires walking though a linked list of data structures. Once a large enough block is found, that block has to be split, and pointers in the linked list nodes must be modified to keep everything intact. For the managed heap, allocating an object simply means adding a value to a pointer—this is blazingly fast by comparison. In fact, allocating an object from the managed heap is nearly as fast as allocating memory from a thread's stack!&lt;br /&gt;So far, it sounds like the managed heap is far superior to the C-runtime heap due to its speed and simplicity of implementation. Of course, the managed heap gains these advantages because it makes one really big assumption: address space and storage are infinite. This assumption is (without a doubt) ridiculous, and there must be a mechanism employed by the managed heap that allows the heap to make this assumption. This mechanism is called the garbage collector. Let's see how it works.&lt;br /&gt;When an application calls the new operator to create an object, there may not be enough address space left in the region to allocate to the object. The heap detects this by adding the size of the new object to NextObjPtr. If NextObjPtr is beyond the end of the address space region, then the heap is full and a collection must be performed.&lt;br /&gt;In reality, a collection occurs when generation 0 is completely full. Briefly, a generation is a mechanism implemented by the garbage collector in order to improve performance. The idea is that newly created objects are part of a young generation, and objects created early in the application's lifecycle are in an old generation. Separating objects into generations can allow the garbage collector to collect specific generations instead of collecting all objects in the managed heap. Generations will be discussed in more detail in Part 2 of this article.&lt;br /&gt;&lt;br /&gt;The Garbage Collection Algorithm&lt;br /&gt;The garbage collector checks to see if there are any objects in the heap that are no longer being used by the application. If such objects exist, then the memory used by these objects can be reclaimed. (If no more memory is available for the heap, then the new operator throws an OutOfMemoryException.) How does the garbage collector know if the application is using an object or not? As you might imagine, this isn't a simple question to answer.&lt;br /&gt;Every application has a set of roots. Roots identify storage locations, which refer to objects on the managed heap or to objects that are set to null. For example, all the global and static object pointers in an application are considered part of the application's roots. In addition, any local variable/parameter object pointers on a thread's stack are considered part of the application's roots. Finally, any CPU registers containing pointers to objects in the managed heap are also considered part of the application's roots. The list of active roots is maintained by the just-in-time (JIT) compiler and common language runtime, and is made accessible to the garbage collector's algorithm.&lt;br /&gt;When the garbage collector starts running, it makes the assumption that all objects in the heap are garbage. In other words, it assumes that none of the application's roots refer to any objects in the heap. Now, the garbage collector starts walking the roots and building a graph of all objects reachable from the roots. For example, the garbage collector may locate a global variable that points to an object in the heap.&lt;br /&gt;Figure 2 shows a heap with several allocated objects where the application's roots refer directly to objects A, C, D, and F. All of these objects become part of the graph. When adding object D, the collector notices that this object refers to object H, and object H is also added to the graph. The collector continues to walk through all reachable objects recursively.&lt;br /&gt;&lt;br /&gt;Once this part of the graph is complete, the garbage collector checks the next root and walks the objects again. As the garbage collector walks from object to object, if it attempts to add an object to the graph that it previously added, then the garbage collector can stop walking down that path. This serves two purposes. First, it helps performance significantly since it doesn't walk through a set of objects more than once. Second, it prevents infinite loops should you have any circular linked lists of objects.&lt;br /&gt;Once all the roots have been checked, the garbage collector's graph contains the set of all objects that are somehow reachable from the application's roots; any objects that are not in the graph are not accessible by the application, and are therefore considered garbage. The garbage collector now walks through the heap linearly, looking for contiguous blocks of garbage objects (now considered free space). The garbage collector then shifts the non-garbage objects down in memory (using the standard memcpy function that you've known for years), removing all of the gaps in the heap. Of course, moving the objects in memory invalidates all pointers to the objects. So the garbage collector must modify the application's roots so that the pointers point to the objects' new locations. In addition, if any object contains a pointer to another object, the garbage collector is responsible for correcting these pointers as well. Figure 3 shows the managed heap after a collection.&lt;br /&gt;&lt;br /&gt;After all the garbage has been identified, all the non-garbage has been compacted, and all the non-garbage pointers have been fixed-up, the NextObjPtr is positioned just after the last non-garbage object. At this point, the new operation is tried again and the resource requested by the application is successfully created.&lt;br /&gt;As you can see, a GC generates a significant performance hit, and this is the major downside of using a managed heap. However, keep in mind that GCs only occur when the heap is full and, until then, the managed heap is significantly faster than a C-runtime heap. The runtime's garbage collector also offers some optimizations that greatly improve the performance of garbage collection. I'll discuss these optimizations in Part 2 of this article when I talk about generations.&lt;br /&gt;There are a few important things to note at this point. You no longer have to implement any code that manages the lifetime of any resources that your application uses. And notice how the two bugs I discussed at the beginning of this article no longer exist. First, it is not possible to leak resources, since any resource not accessible from your application's roots can be collected at some point. Second, it is not possible to access a resource that is freed, since the resource won't be freed if it is reachable. If it's not reachable, then your application has no way to access it. The code in Figure 4 demonstrates how resources are allocated and managed.&lt;br /&gt;If GC is so great, you might be wondering why it isn't in ANSI C++. The reason is that a garbage collector must be able to identify an application's roots and must also be able to find all object pointers. The problem with C++ is that it allows casting a pointer from one type to another, and there's no way to know what a pointer refers to. In the common language runtime, the managed heap always knows the actual type of an object, and the metadata information is used to determine which members of an object refer to other objects.&lt;br /&gt;&lt;br /&gt;Finalization&lt;br /&gt;The garbage collector offers an additional feature that you may want to take advantage of: finalization. Finalization allows a resource to gracefully clean up after itself when it is being collected. By using finalization, a resource representing a file or network connection is able to clean itself up properly when the garbage collector decides to free the resource's memory.&lt;br /&gt;Here is an oversimplification of what happens: when the garbage collector detects that an object is garbage, the garbage collector calls the object's Finalize method (if it exists) and then the object's memory is reclaimed. For example, let's say you have the following type (in C#):&lt;br /&gt;&lt;br /&gt;public class BaseObj {&lt;br /&gt;public BaseObj() {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;protected override void Finalize() {&lt;br /&gt;// Perform resource cleanup code here...&lt;br /&gt;// Example: Close file/Close network connection&lt;br /&gt;Console.WriteLine("In Finalize.");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now you can create an instance of this object by calling:&lt;br /&gt;&lt;br /&gt;BaseObj bo = new BaseObj();&lt;br /&gt;&lt;br /&gt;Some time in the future, the garbage collector will determine that this object is garbage. When that happens, the garbage collector will see that the type has a Finalize method and will call the method, causing "In Finalize" to appear in the console window and reclaiming the memory block used by this object.&lt;br /&gt;Many developers who are used to programming in C++ draw an immediate correlation between a destructor and the Finalize method. However, let me warn you right now: object finalization and destructors have very different semantics and it is best to forget everything you know about destructors when thinking about finalization. Managed objects never have destructors—period.&lt;br /&gt;When designing a type it is best to avoid using a Finalize method. There are several reasons for this:&lt;br /&gt;&lt;br /&gt;Finalizable objects get promoted to older generations, which increases memory pressure and prevents the object's memory from being collected when the garbage collector determines the object is garbage. In addition, all objects referred to directly or indirectly by this object get promoted as well. Generations and promotions will be discussed in Part 2 of this article.&lt;br /&gt;&lt;br /&gt;Finalizable objects take longer to allocate.&lt;br /&gt;&lt;br /&gt;Forcing the garbage collector to execute a Finalize method can significantly hurt performance. Remember, each object is finalized. So if I have an array of 10,000 objects, each object must have its Finalize method called.&lt;br /&gt;&lt;br /&gt;Finalizable objects may refer to other (non-finalizable) objects, prolonging their lifetime unnecessarily. In fact, you might want to consider breaking a type into two different types: a lightweight type with a Finalize method that doesn't refer to any other objects, and a separate type without a Finalize method that does refer to other objects.&lt;br /&gt;&lt;br /&gt;You have no control over when the Finalize method will execute. The object may hold on to resources until the next time the garbage collector runs.&lt;br /&gt;&lt;br /&gt;When an application terminates, some objects are still reachable and will not have their Finalize method called. This can happen if background threads are using the objects or if objects are created during application shutdown or AppDomain unloading. In addition, by default, Finalize methods are not called for unreachable objects when an application exits so that the application may terminate quickly. Of course, all operating system resources will be reclaimed, but any objects in the managed heap are not able to clean up gracefully. You can change this default behavior by calling the System.GC type's RequestFinalizeOnShutdown method. However, you should use this method with care since calling it means that your type is controlling a policy for the entire application.&lt;br /&gt;&lt;br /&gt;The runtime doesn't make any guarantees as to the order in which Finalize methods are called. For example, let's say there is an object that contains a pointer to an inner object. The garbage collector has detected that both objects are garbage. Furthermore, say that the inner object's Finalize method gets called first. Now, the outer object's Finalize method is allowed to access the inner object and call methods on it, but the inner object has been finalized and the results may be unpredictable. For this reason, it is strongly recommended that Finalize methods not access any inner, member objects.&lt;br /&gt;&lt;br /&gt;If you determine that your type must implement a Finalize method, then make sure the code executes as quickly as possible. Avoid all actions that would block the Finalize method, including any thread synchronization operations. Also, if you let any exceptions escape the Finalize method, the system just assumes that the Finalize method returned and continues calling other objects' Finalize methods.&lt;br /&gt;When the compiler generates code for a constructor, the compiler automatically inserts a call to the base type's constructor. Likewise, when a C++ compiler generates code for a destructor, the compiler automatically inserts a call to the base type's destructor. However, as I've said before, Finalize methods are different from destructors. The compiler has no special knowledge about a Finalize method, so the compiler does not automatically generate code to call a base type's Finalize method. If you want this behavior—and frequently you do—then you must explicitly call the base type's Finalize method from your type's Finalize method:&lt;br /&gt;&lt;br /&gt;public class BaseObj {&lt;br /&gt;public BaseObj() {&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;protected override void Finalize() {&lt;br /&gt;Console.WriteLine("In Finalize.");&lt;br /&gt;base.Finalize(); // Call base type's Finalize&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Note that you'll usually call the base type's Finalize method as the last statement in the derived type's Finalize method. This keeps the object alive as long as possible. Since calling a base type Finalize method is common, C# has a syntax that simplifies your work. In C#, the following code&lt;br /&gt;&lt;br /&gt;class MyObject {&lt;br /&gt;~MyObject() {&lt;br /&gt;•••&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;causes the compiler to generate this code:&lt;br /&gt;&lt;br /&gt;class MyObject {&lt;br /&gt;protected override void Finalize() {&lt;br /&gt;•••&lt;br /&gt;base.Finalize();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Note that this C# syntax looks identical to the C++ language's syntax for defining a destructor. But remember, C# doesn't support destructors. Don't let the identical syntax fool you.&lt;br /&gt;&lt;br /&gt;Finalization Internals&lt;br /&gt;On the surface, finalization seems pretty straightforward: you create an object and when the object is collected, the object's Finalize method is called. But there is more to finalization than this.&lt;br /&gt;When an application creates a new object, the new operator allocates the memory from the heap. If the object's type contains a Finalize method, then a pointer to the object is placed on the finalization queue. The finalization queue is an internal data structure controlled by the garbage collector. Each entry in the queue points to an object that should have its Finalize method called before the object's memory can be reclaimed.&lt;br /&gt;Figure 5 shows a heap containing several objects. Some of these objects are reachable from the application's roots, and some are not. When objects C, E, F, I, and J were created, the system detected that these objects had Finalize methods and pointers to these objects were added to the finalization queue.&lt;br /&gt;&lt;br /&gt;When a GC occurs, objects B, E, G, H, I, and J are determined to be garbage. The garbage collector scans the finalization queue looking for pointers to these objects. When a pointer is found, the pointer is removed from the finalization queue and appended to the freachable queue (pronounced "F-reachable"). The freachable queue is another internal data structure controlled by the garbage collector. Each pointer in the freachable queue identifies an object that is ready to have its Finalize method called.&lt;br /&gt;After the collection, the managed heap looks like Figure 6. Here, you see that the memory occupied by objects B, G, and H has been reclaimed because these objects did not have a Finalize method that needed to be called. However, the memory occupied by objects E, I, and J could not be reclaimed because their Finalize method has not been called yet.&lt;br /&gt;&lt;br /&gt;There is a special runtime thread dedicated to calling Finalize methods. When the freachable queue is empty (which is usually the case), this thread sleeps. But when entries appear, this thread wakes, removes each entry from the queue, and calls each object's Finalize method. Because of this, you should not execute any code in a Finalize method that makes any assumption about the thread that's executing the code. For example, avoid accessing thread local storage in the Finalize method.&lt;br /&gt;The interaction of the finalization queue and the freachable queue is quite fascinating. First, let me tell you how the freachable queue got its name. The f is obvious and stands for finalization; every entry in the freachable queue should have its Finalize method called. The "reachable" part of the name means that the objects are reachable. To put it another way, the freachable queue is considered to be a root just like global and static variables are roots. Therefore, if an object is on the freachable queue, then the object is reachable and is not garbage.&lt;br /&gt;In short, when an object is not reachable, the garbage collector considers the object garbage. Then, when the garbage collector moves an object's entry from the finalization queue to the freachable queue, the object is no longer considered garbage and its memory is not reclaimed. At this point, the garbage collector has finished identifying garbage. Some of the objects identified as garbage have been reclassified as not garbage. The garbage collector compacts the reclaimable memory and the special runtime thread empties the freachable queue, executing each object's Finalize method.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The next time the garbage collector is invoked, it sees that the finalized objects are truly garbage, since the application's roots don't point to it and the freachable queue no longer points to it. Now the memory for the object is simply reclaimed. The important thing to understand here is that two GCs are required to reclaim memory used by objects that require finalization. In reality, more than two collections may be necessary since the objects could get promoted to an older generation. Figure 7 shows what the managed heap looks like after the second GC.&lt;br /&gt;&lt;br /&gt;Resurrection&lt;br /&gt;The whole concept of finalization is fascinating. However, there is more to it than what I've described so far. You'll notice in the previous section that when an application is no longer accessing a live object, the garbage collector considers the object to be dead. However, if the object requires finalization, the object is considered live again until it is actually finalized, and then it is permanently dead. In other words, an object requiring finalization dies, lives, and then dies again. This is a very interesting phenomenon called resurrection. Resurrection, as its name implies, allows an object to come back from the dead.&lt;br /&gt;I've already described a form of resurrection. When the garbage collector places a reference to the object on the freachable queue, the object is reachable from a root and has come back to life. Eventually, the object's Finalize method is called, no roots point to the object, and the object is dead forever after. But what if an object's Finalize method executed code that placed a pointer to the object in a global or static variable?&lt;br /&gt;&lt;br /&gt;public class BaseObj {&lt;br /&gt;&lt;br /&gt;protected override void Finalize() {&lt;br /&gt;Application.ObjHolder = this;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class Application {&lt;br /&gt;static public Object ObjHolder; // Defaults to null&lt;br /&gt;•••&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;In this case, when the object's Finalize method executes, a pointer to the object is placed in a root and the object is reachable from the application's code. This object is now resurrected and the garbage collector will not consider the object to be garbage. The application is free to use the object, but it is very important to note that the object has been finalized and that using the object may cause unpredictable results. Also note: if BaseObj contained members that pointed to other objects (either directly or indirectly), all objects would be resurrected, since they are all reachable from the application's roots. However, be aware that some of these other objects may also have been finalized.&lt;br /&gt;In fact, when designing your own object types, objects of your type can get finalized and resurrected totally out of your control. Implement your code so that you handle this gracefully. For many types, this means keeping a Boolean flag indicating whether the object has been finalized or not. Then, if methods are called on your finalized object, you might consider throwing an exception. The exact technique to use depends on your type.&lt;br /&gt;Now, if some other piece of code sets Application.ObjHolder to null, the object is unreachable. Eventually the garbage collector will consider the object to be garbage and will reclaim the object's storage. Note that the object's Finalize method will not be called because no pointer to the object exists on the finalization queue.&lt;br /&gt;There are very few good uses of resurrection, and you really should avoid it if possible. However, when people do use resurrection, they usually want the object to clean itself up gracefully every time the object dies. To make this possible, the GC type offers a method called ReRegisterForFinalize, which takes a single parameter: the pointer to an object.&lt;br /&gt;&lt;br /&gt;public class BaseObj {&lt;br /&gt;&lt;br /&gt;protected override void Finalize() {&lt;br /&gt;Application.ObjHolder = this;&lt;br /&gt;GC.ReRegisterForFinalize(this);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;When this object's Finalize method is called, it resurrects itself by making a root point to the object. The Finalize method then calls ReRegisterForFinalize, which appends the address of the specified object (this) to the end of the finalization queue. When the garbage collector detects that this object is unreachable again, it will queue the object's pointer on the freachable queue and the Finalize method will get called again. This specific example shows how to create an object that constantly resurrects itself and never dies, which is usually not desirable. It is far more common to conditionally set a root to reference the object inside the Finalize method.&lt;br /&gt;Make sure that you call ReRegisterForFinalize no more than once per resurrection, or the object will have its Finalize method called multiple times. This happens because each call to ReRegisterForFinalize appends a new entry to the end of the finalization queue. When an object is determined to be garbage, all of these entries move from the finalization queue to the freachable queue, calling the object's Finalize method multiple times.&lt;br /&gt;&lt;br /&gt;Forcing an Object to Clean Up&lt;br /&gt;If you can, you should try to define objects that do not require any clean up. Unfortunately, for many objects, this is simply not possible. So for these objects, you must implement a Finalize method as part of the type's definition. However, it is also recommended that you add an additional method to the type that allows a user of the type to explicitly clean up the object when they want. By convention, this method should be called Close or Dispose.&lt;br /&gt;In general, you use Close if the object can be reopened or reused after it has been closed. You also use Close if the object is generally considered to be closed, such as a file. On the other hand, you would use Dispose if the object should no longer be used at all after it has been disposed. For example, to delete a System.Drawing.Brush object, you call its Dispose method. Once disposed, the Brush object cannot be used, and calling methods to manipulate the object may cause exceptions to be thrown. If you need to work with another Brush, you must construct a new Brush object.&lt;br /&gt;Now, let's look at what the Close/Dispose method is supposed to do. The System.IO.FileStream type allows the user to open a file for reading and writing. To improve performance, the type's implementation makes use of a memory buffer. Only when the buffer fills does the type flush the contents of the buffer to the file. Let's say that you create a new FileStream object and write just a few bytes of information to it. If these bytes don't fill the buffer, then the buffer is not written to disk. The FileStream type does implement a Finalize method, and when the FileStream object is collected the Finalize method flushes any remaining data from memory to disk and then closes the file.&lt;br /&gt;But this approach may not be good enough for the user of the FileStream type. Let's say that the first FileStream object has not been collected yet, but the application wants to create a new FileStream object using the same disk file. In this scenario, the second FileStream object will fail to open the file if the first FileStream object had the file open for exclusive access. The user of the FileStream object must have some way to force the final memory flush to disk and to close the file.&lt;br /&gt;If you examine the FileStream type's documentation, you'll see that it has a method called Close. When called, this method flushes the remaining data in memory to the disk and closes the file. Now the user of a FileStream object has control of the object's behavior.&lt;br /&gt;But an interesting problem arises now: what should the FileStream's Finalize method do when the FileStream object is collected? Obviously, the answer is nothing. In fact, there is no reason for the FileStream's Finalize method to execute at all if the application has explicitly called the Close method. You know that Finalize methods are discouraged, and in this scenario you're going to have the system call a Finalize method that should do nothing. It seems like there ought to be a way to suppress the system's calling of the object's Finalize method. Fortunately, there is. The System.GC type contains a static method, SuppressFinalize, that takes a single parameter, the address of an object.&lt;br /&gt;Figure 8 shows FileStream's type implementation. When you call SuppressFinalize, it turns on a bit flag associated with the object. When this flag is on, the runtime knows not to move this object's pointer to the freachable queue, preventing the object's Finalize method from being called.&lt;br /&gt;Let's examine another related issue. It is very common to use a StreamWriter object with a FileStream object.&lt;br /&gt;&lt;br /&gt;FileStream fs = new FileStream("C:\\SomeFile.txt",&lt;br /&gt;FileMode.Open, FileAccess.Write, FileShare.Read);&lt;br /&gt;StreamWriter sw = new StreamWriter(fs);&lt;br /&gt;sw.Write ("Hi there");&lt;br /&gt;&lt;br /&gt;// The call to Close below is what you should do&lt;br /&gt;sw.Close();&lt;br /&gt;// NOTE: StreamWriter.Close closes the FileStream. The FileStream&lt;br /&gt;// should not be explicitly closed in this scenario&lt;br /&gt;&lt;br /&gt;Notice that the StreamWriter's constructor takes a FileStream object as a parameter. Internally, the StreamWriter object saves the FileStream's pointer. Both of these objects have internal data buffers that should be flushed to the file when you're finished accessing the file. Calling the StreamWriter's Close method writes the final data to the FileStream and internally calls the FileStream's Close method, which writes the final data to the disk file and closes the file. Since StreamWriter's Close method closes the FileStream object associated with it, you should not call fs.Close yourself.&lt;br /&gt;What do you think would happen if you removed the two calls to Close? Well, the garbage collector would correctly detect that the objects are garbage and the objects would get finalized. But, the garbage collector doesn't guarantee the order in which the Finalize methods are called. So if the FileStream gets finalized first, it closes the file. Then when the StreamWriter gets finalized, it would attempt to write data to the closed file, raising an exception. Of course, if the StreamWriter got finalized first, then the data would be safely written to the file.&lt;br /&gt;How did Microsoft solve this problem? Making the garbage collector finalize objects in a specific order is impossible because objects could contain pointers to each other and there is no way for the garbage collector to correctly guess the order to finalize these objects. So, here is Microsoft's solution: the StreamWriter type doesn't implement a Finalize method at all. Of course, this means that forgetting to explicitly close the StreamWriter object guarantees data loss. Microsoft expects that developers will see this consistent loss of data and will fix the code by inserting an explicit call to Close.&lt;br /&gt;As stated earlier, the SuppressFinalize method simply sets a bit flag indicating that the object's Finalize method should not be called. However, this flag is reset when the runtime determines that it's time to call a Finalize method. This means that calls to ReRegisterForFinalize cannot be balanced by calls to SuppressFinalize. The code in Figure 9 demonstrates exactly what I mean.&lt;br /&gt;ReRegisterForFinalize and SuppressFinalize are implemented the way they are for performance reasons. As long as each call to SuppressFinalize has an intervening call to ReRegisterForFinalize, everything works. It is up to you to ensure that you do not call ReRegisterForFinalize or SuppressFinalize multiple times consecutively, or multiple calls to an object's Finalize method can occur.&lt;br /&gt;&lt;br /&gt;Conclusion&lt;br /&gt;The motivation for garbage-collected environments is to simplify memory management for the developer. The first part of this overview looked at some general GC concepts and internals. In Part 2, I will conclude this discussion. First, I will explore a feature called WeakReferences, which you can use to reduce the memory pressure placed on the managed heap by large objects. Then I'll examine a mechanism that allows you to artificially extend the lifetime of a managed object. Finally, I'll wrap up by discussing various aspects of the garbage collector's performance. I'll discuss generations, multithreaded collections, and the performance counters that the common language runtime exposes, which allow you to monitor the garbage collector's real-time behavior.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-112973211573831530?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112973211573831530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112973211573831530'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/10/garbage-collection-in-net-kaushal.html' title='Garbage Collection in .NET : Kaushal'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112653661090585304</id><published>2005-09-12T07:28:00.000-07:00</published><updated>2008-05-27T05:14:57.560-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Convert Custom Objects in XML Data Using Reflection</title><content type='html'>&lt;span style="font-family:verdana;font-size:85%;"&gt;//Created By Kaushal&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;public string ConvertToXML()&lt;br /&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;//output will used to store parent object's xml representation&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;StringBuilder output = new StringBuilder(); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;//output will used to store child object's xml representation&lt;br /&gt;&lt;br /&gt;StringBuilder refOutput = new StringBuilder();&lt;br /&gt;&lt;br /&gt;//I am considering Object Node is Root Node..&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append("&lt;customobjects&gt;&lt;objects&gt;&lt;objects&gt;");&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;//Getting Count of parent Objects&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;for (int i=0;i&lt;=this.Count-1;i++) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;//Getting Properties Info using Reflection&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PropertyInfo[] objFields = this.List[i].GetType().GetProperties(); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;//Adding Reflected Object Type in to XML String as Parent Node of an Entity as Node Name&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append("&lt;" + objFields[0].ReflectedType.Name.ToString() + "&gt;");&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;//Appending Data as seprate Attribute in the node&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append("&lt;" + objFields[0].ReflectedType.Name.ToString()); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;// Accessing each property&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;foreach(PropertyInfo prop in objFields) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;//Checking that the current property is Readable or not&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;if (prop.CanRead) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;//If yes then checking the return type of the property. If its Value Type or Normal String I am handling it in the ELSE part.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;if ((!prop.PropertyType.IsValueType) &amp;amp;&amp;amp; (prop.PropertyType !=typeof(System.String)) &amp;amp;&amp;amp; (prop.PropertyType !=typeof(Framework.CError)) ) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;//Getting Value from Reflected Object &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;object oCustomObject = prop.GetValue(this[i] as object,null); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;//Appending object's value into XML&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;if (null!=oCustomObject) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;//if object type is ref. type then it will go for recursion call in the next private function.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;refOutput.Append(ConvertToXML(oCustomObject)); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;else &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;//Getting data of property in case of value type or String&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Object strObjectString = prop.GetValue(this.List[i] as object,null); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;if (null!=strObjectString) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append(" " + prop.Name.ToString() + "='"); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append(strObjectString.ToString()+ "'"); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append("/&gt;");&lt;br /&gt;output.Append(refOutput.ToString());&lt;br /&gt;refOutput.Remove(0,refOutput.Length);&lt;br /&gt;output.Append("&lt;/" ? + objFields[0].ReflectedType.Name.ToString()&gt; output = output.Replace("Key","ID");&lt;br /&gt;}&lt;br /&gt;output.Append("&lt;customobjects&gt;&lt;/objects&gt;&lt;/objects&gt;");&lt;br /&gt;return output.ToString();&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;//Created By Kaushal&lt;br /&gt;private string ConvertToXML(object oUserObject)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;StringBuilder output = new StringBuilder();&lt;br /&gt;StringBuilder refOutput = new StringBuilder();&lt;br /&gt;Type objectType = oUserObject.GetType().BaseType;&lt;br /&gt;int iCount = objectType==typeof(System.Object)? 1 : (oUserObject as EntityCollectionBase).Count;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append(objectType==typeof(System.Object)? "&lt;" + oUserObject.GetType().Name + "&gt;" : "&lt;objects&gt;");&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;for (int i=0;i&lt;=iCount-1;i++) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;PropertyInfo[] objFields = objectType==typeof(System.Object)? oUserObject.GetType().GetProperties() : (oUserObject as EntityCollectionBase)[i].GetType().GetProperties(); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Object oTmpObject = objectType==typeof(System.Object)? oUserObject : (oUserObject as EntityCollectionBase)[i] as object; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append("&lt;" + objFields[0].ReflectedType.Name.ToString() + "&gt;");&lt;br /&gt;output.Append("&lt;" + objFields[0].ReflectedType.Name.ToString()); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;foreach(PropertyInfo prop in objFields) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;if (prop.CanRead) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;if ((!prop.PropertyType.IsValueType) &amp;amp;&amp;amp; (prop.PropertyType !=typeof(System.String)) &amp;amp;&amp;amp; (prop.PropertyType !=typeof(Framework.CError)) ) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;object oCustomObject = prop.GetValue(oTmpObject as object,null) as object; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;if (null!=oCustomObject) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;//Making Nested Calls&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;refOutput.Append(ConvertToXML(oCustomObject)); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;else &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Object strObjectString = prop.GetValue(oTmpObject,null); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;if (null!=strObjectString) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append(" " + prop.Name.ToString() + "='"); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append(strObjectString.ToString()+ "'"); &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output.Append("/&gt;");&lt;br /&gt;output.Append(refOutput.ToString());&lt;br /&gt;refOutput.Remove(0,refOutput.Length);&lt;br /&gt;output.Append("&lt;/" ? + objFields[0].ReflectedType.Name.ToString()&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;output = output.Replace("Key","ID");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;}&lt;br /&gt;&lt;br /&gt;output.Append(objectType==typeof(System.Object)? "&lt;/" ? + oUserObject.GetType().Name&gt;return output.ToString();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;4 More Details Mail me @ &lt;a href="mailto:mail2kaushal@gmail.com"&gt;mail2kaushal@gmail.com&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-112653661090585304?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112653661090585304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112653661090585304'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/09/convert-custom-objects-in-xml-data.html' title='Convert Custom Objects in XML Data Using Reflection'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112619101967926599</id><published>2005-09-08T07:43:00.000-07:00</published><updated>2008-05-27T05:15:57.446-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Generate Property Classes On Fly : Kaushal Patel</title><content type='html'>&lt;span style="font-family:verdana;font-size:85%;"&gt;Class Used : PropertyBuilder [PropertyBuilder Class defines the properties for a type.]&lt;br /&gt;&lt;br /&gt;Code : &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;p&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Reflection;&lt;br /&gt;using System.Reflection.Emit;&lt;br /&gt;using System.Threading;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;class PropertyBuilderDemo&lt;br /&gt;{&lt;br /&gt;public static Type BuildProperties()&lt;br /&gt;{&lt;br /&gt;AppDomain _Domain = Thread.GetDomain();&lt;br /&gt;AssemblyName _AssemblyName = new AssemblyName();&lt;br /&gt;_AssemblyName.Name = "DynamicAssembly";&lt;br /&gt;&lt;br /&gt;AssemblyBuilder _AssemblyBuilder = _Domain.DefineDynamicAssembly(_AssemblyName,AssemblyBuilderAccess.RunAndSave);&lt;br /&gt;&lt;br /&gt;ModuleBuilder _ModuleBuilder = _AssemblyBuilder.DefineDynamicModule("DynamicModule");&lt;br /&gt;TypeBuilder _TypeBuilder = _ModuleBuilder.DefineType("CustomerData",TypeAttributes.Public);&lt;br /&gt;FieldBuilder _customerName = _TypeBuilder.DefineField("_CustomerName",typeof(string),FieldAttributes.Private);&lt;br /&gt;PropertyBuilder _CustomerName = _TypeBuilder.DefineProperty("CustomerName",PropertyAttributes.HasDefault,typeof(string),new Type[] { typeof(string) });&lt;br /&gt;//Assigning 'Get' Behavior to Customer Name Property&lt;/span&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;br /&gt;MethodBuilder _GetCustomerName = _TypeBuilder.DefineMethod("GetCustomerName",MethodAttributes.Public,typeof(string),new Type[] { });&lt;br /&gt;&lt;br /&gt;ILGenerator _GetILGenerator = _GetCustomerName.GetILGenerator();&lt;br /&gt;_GetILGenerator.Emit(OpCodes.Ldarg_0);&lt;br /&gt;_GetILGenerator.Emit(OpCodes.Ldfld,_customerName);&lt;br /&gt;_GetILGenerator.Emit(OpCodes.Ret);&lt;br /&gt;//Assigning 'Set' Behavior to Customer Name Property&lt;br /&gt;MethodBuilder _SetCustomerName = _TypeBuilder.DefineMethod("SetCustomerName",MethodAttributes.Public,null,new Type[] { typeof(string) });&lt;br /&gt;&lt;br /&gt;ILGenerator _SetILGenerator = _SetCustomerName.GetILGenerator();&lt;br /&gt;_SetILGenerator.Emit(OpCodes.Ldarg_0);&lt;br /&gt;_SetILGenerator.Emit(OpCodes.Ldarg_1);&lt;br /&gt;_SetILGenerator.Emit(OpCodes.Stfld,_customerName);&lt;br /&gt;_SetILGenerator.Emit(OpCodes.Ret);&lt;br /&gt;//Attaching Get and Set behaviors to property&lt;br /&gt;_CustomerName.SetGetMethod(_GetCustomerName);&lt;br /&gt;_CustomerName.SetSetMethod(_SetCustomerName);&lt;br /&gt;&lt;br /&gt;return _TypeBuilder.CreateType();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;///Client Code&lt;br /&gt;&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;Type customer = PropertyBuilderDemo.BuildProperties();&lt;br /&gt;PropertyInfo[] properties = customer.GetProperties();&lt;br /&gt;object customerData = Activator.CreateInstance(customer);&lt;br /&gt;properties[0].SetValue(customerData,"CREATED BY : Kaushal Patel",BindingFlags.SetProperty,null,null,null);&lt;br /&gt;string s = properties[0].GetValue(customerData,BindingFlags.GetProperty,null,null,null).ToString();&lt;br /&gt;Console.WriteLine(s.ToString());&lt;br /&gt;Console.ReadLine();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;4 More Information Do Mail Me @ &lt;a href="mailto:mail2kaushal@gmail.com"&gt;mail2kaushal@gmail.com&lt;/a&gt;&lt;/span&gt; &lt;p&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-112619101967926599?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112619101967926599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112619101967926599'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/09/generate-property-classes-on-fly.html' title='Generate Property Classes On Fly : Kaushal Patel'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112600891915365305</id><published>2005-09-06T04:29:00.000-07:00</published><updated>2008-05-27T05:17:36.790-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>The Importance of Using Managed Code in .NET</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Introduction&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What is managed code and why is it important to use 100% managed&lt;br /&gt;code in .NET applications?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Managed code is compiled for the .NET run-time environment. It&lt;br /&gt;runs in the Common Language Runtime (CLR), which is the heart of&lt;br /&gt;the .NET Framework. The CLR provides services such as security,&lt;br /&gt;memory management, and cross-language integration. (3) Managed&lt;br /&gt;applications written to take advantage of the features of the CLR&lt;br /&gt;perform more efficiently&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and safely, and take better advantage of developers’&lt;br /&gt;existing expertise in languages that support the .NET&lt;br /&gt;Framework.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Unmanaged code includes all code written before the .NET&lt;br /&gt;Framework was introduced—this includes code written to use&lt;br /&gt;COM, native Win32, and Visual Basic 6. Because it does not run&lt;br /&gt;inside the .NET environment, unmanaged&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;code cannot make use of any .NET managed facilities. (1)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Advantages of Using Managed Code&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Managed code runs entirely “inside the sandbox,”&lt;br /&gt;meaning that it makes no&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;calls outside of the .NET Framework. That’s why managed&lt;br /&gt;code gets the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;maximum benefit from the features of the .NET Framework, and&lt;br /&gt;why&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;applications built with managed code perform more safely and&lt;br /&gt;efficiently.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Performance&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The CLR was designed from the start to provide good performance.&lt;br /&gt;By using 100% managed code, you can take advantage of the numerous&lt;br /&gt;built-in services of the CLR to enhance the&lt;br /&gt;performance of your managed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;application. Because of the runtime services and checks that the&lt;br /&gt;CLR performs, applications do not need to include separate versions&lt;br /&gt;of these services. (9) And by using 100% managed code, you&lt;br /&gt;eliminate the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;performance costs associated with calling unmanaged code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Just-In-Time compiler&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The CLR never executes Common Intermediate Language (CIL)&lt;br /&gt;directly.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Instead, the Just-In-Time (JIT) compiler translates CIL into&lt;br /&gt;optimized x86&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;native instructions. (9) That’s why using managed code&lt;br /&gt;lets your software run&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;in different environments safely and efficiently. In addition,&lt;br /&gt;using machine&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;language lets you take full advantage of the features of the&lt;br /&gt;processor the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;application is running on. For example, when the JIT encounters&lt;br /&gt;an Intel&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;processor, the code produced takes advantage of&lt;br /&gt;hyper-threading&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;technology. (5)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another advantage of the JIT is improved performance. The JIT&lt;br /&gt;learns when&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;the code&lt;br /&gt;does multiple iterations. The runtime is designed to be able to&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;retune the JIT compiled code as your program runs. (2)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NGEN utility&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NGEN.exe is a .NET utility that pre-compiles the application at&lt;br /&gt;install time.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Pre-compiling improves start-up performance for managed code,&lt;br /&gt;especially&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;when the application uses Windows Forms. Methods are JITed when&lt;br /&gt;they&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;are first used, incurring a larger startup penalty if the&lt;br /&gt;application calls many&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;methods during start-up. Because Windows Forms uses many&lt;br /&gt;shared&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;libraries in the operating system, pre-compiling Windows Forms&lt;br /&gt;applications&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;usually improves performance. (12)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Pre-compiling also makes sure that the application is optimized&lt;br /&gt;for the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;machine on which it is being installed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Maintaining a 100% managed code environment&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Only when your .NET application uses components that are built&lt;br /&gt;using 100%&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;managed code do you receive the full benefits of the .NET&lt;br /&gt;environment.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For example, when accessing data through ADO.NET, using wire&lt;br /&gt;protocol&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.NET data providers lets you preserve your managed code&lt;br /&gt;environment&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;because they do not make calls to native Win32 APIs and Client&lt;br /&gt;pieces.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The performance advantages of the managed code environment are&lt;br /&gt;lost&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;when you (or the components you are using) call unmanaged code.&lt;br /&gt;The CLR&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;makes additional checks on calls to the unmanaged or native&lt;br /&gt;code, which&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;impacts performance.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Unmanaged code includes the database client pieces that some&lt;br /&gt;.NET data&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;providers require. Examples of .NET data providers that use both&lt;br /&gt;managed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and unmanaged code are IBM’s DB2 data provider and the&lt;br /&gt;Oracle Data&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Provider for .NET (ODP.NET). Both of these data providers must&lt;br /&gt;use client&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;libraries to access the database. The data providers shipped&lt;br /&gt;Microsoft for&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL Server and Oracle—as well as the Microsoft OLE DB data&lt;br /&gt;providers,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and ODBC.NET—make calls to native Win32 database client&lt;br /&gt;pieces or other&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;unmanaged code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Automatic memory management&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Automatic memory management is one of the most significant&lt;br /&gt;features of&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;managed code. The CLR garbage collector automatically frees&lt;br /&gt;allocated&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;objects when there are no longer any outstanding references to&lt;br /&gt;them. The&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;developer does not need to explicitly free memory assigned to an&lt;br /&gt;object,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;which goes a long way toward reducing the amount of time spent&lt;br /&gt;debugging&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;memory leaks. (10) There can be no memory leaks in 100% managed&lt;br /&gt;code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Automatic lifetime control of objects&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another significant advantage of using managed code is that the&lt;br /&gt;CLR&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;provides automatic lifetime management of components and&lt;br /&gt;modules.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lifetime control includes:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;• Garbage collection, which frees and compacts&lt;br /&gt;memory.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;• Scalability features, such as thread pooling&lt;br /&gt;and the ability to use a nonpersistent&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;connection with a dataset.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;• Support for side-by-side versions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Garbage collection&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When an object is created with the new operator,&lt;br /&gt;the runtime allocates&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;memory from the managed heap. Periodically, the CLR garbage&lt;br /&gt;collector&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;checks the heap and automatically disposes of any objects that&lt;br /&gt;are no longer&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;being used by the application, reclaiming their memory.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The garbage collector also compacts the released memory,&lt;br /&gt;reducing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;fragmentation. (4) This function is particularly important when&lt;br /&gt;the application&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;runs on large memory servers. Changing the application to use&lt;br /&gt;smaller&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;objects can help to improve the effectiveness of the garbage&lt;br /&gt;collector.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Similarly, because each DLL is assigned a 64-bit chunk of&lt;br /&gt;memory,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;combining small DLLs avoids inefficient use of memory.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Because the garbage collector automatically closes unused&lt;br /&gt;objects, memory&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;leaks are not possible in an application that uses 100% managed&lt;br /&gt;code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Scalability features&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thread pooling lets you make much more efficient use of multiple&lt;br /&gt;threads&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and is an important scalability feature of using managed code.&lt;br /&gt;The .NET&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Framework comes with built-in support for creating threads and&lt;br /&gt;using the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;system-provided thread pool. In particular, the ThreadPool class&lt;br /&gt;under the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;System.Threading namespace provides static methods for&lt;br /&gt;submitting&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;requests to the thread pool. In managed code, if one of the&lt;br /&gt;threads becomes&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;idle, the thread pool injects another worker thread into the&lt;br /&gt;multithread&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;apartment to keep all the processors busy.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The standard ThreadPool methods capture the caller’s stack&lt;br /&gt;and merge it&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;into the stack of the thread-pool thread when the thread-pool&lt;br /&gt;thread starts to&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;execute a task. If you are using unmanaged code, the entire&lt;br /&gt;stack will be&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;checked, which incurs a performance cost. In some cases, you can&lt;br /&gt;eliminate&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;the stack checking with the Unsafe methods&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ThreadPool.UnsafeQueueUserWorkItem and&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ThreadPool.UnsafeRegisterWaitForSingleObject, which provide&lt;br /&gt;better&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;performance. However, using the Unsafe method calls does not&lt;br /&gt;provide&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;complete safety. (8)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Further adding to scalability is the ability to use a&lt;br /&gt;non-persistent connection&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;with a dataset, which is a cache of the records retrieved from&lt;br /&gt;the database.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The dataset keeps track of the state of the data and stores the&lt;br /&gt;data as pure&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;XML. Database connections are opened and closed only as needed&lt;br /&gt;to&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;retrieve data into the dataset, or to return updated data.&lt;br /&gt;(7)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Versioning&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Versioning essentially eliminates “DLL hell.” When&lt;br /&gt;you define an assembly as&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;strongly named, the .NET executable will be executed with the&lt;br /&gt;same DLL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;with which it was built. This means that you can have&lt;br /&gt;side-by-side versions of&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;a DLL, allowing you to manage shared components. Versioning&lt;br /&gt;ensures that&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;each time an application starts up, it checks its shared files.&lt;br /&gt;If a file has&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;changed and the changes are incompatible, the application can&lt;br /&gt;ask the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;runtime for a compatible version.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However, when an application calls unmanaged DLLs, you can end&lt;br /&gt;up back&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;in “DLL hell.” For example, Oracle’s ODP.NET&lt;br /&gt;data provider calls the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;unmanaged Oracle Client pieces, which are specific to a&lt;br /&gt;particular version of&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Oracle. You could install two versions of this unmanaged&lt;br /&gt;data provider, for&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;example, one for Oracle9i and one for the upcoming Oracle10G,&lt;br /&gt;but you&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;would have a conflict, because each data provider will require a&lt;br /&gt;particular&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;version of the clients. Since the clients are native Win32 DLLs,&lt;br /&gt;you cannot&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;easily have side-by-side versions running on the same machine.&lt;br /&gt;Only with&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;native wire protocol data providers built from 100% managed code&lt;br /&gt;can you&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;install side-by-side versions with no configuration required by&lt;br /&gt;the end-user.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Checks by the .NET runtime&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The .NET runtime automatically performs numerous checks to&lt;br /&gt;ensure that&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;code is written correctly. Because these checks prevent a large&lt;br /&gt;number of&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;bugs from ever happening, developer productivity is improved and&lt;br /&gt;the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;application quality is better. In addition, these checks thwart&lt;br /&gt;system attacks&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;such as the exploitation of buffer overruns.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The CLR checks for type safety to ensure that applications&lt;br /&gt;always access&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;allocated objects in appropriate ways. In other words, if a&lt;br /&gt;method input&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;parameter is declared as accepting a 4-byte value, the common&lt;br /&gt;language&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;runtime will detect and trap attempts to access the parameter as&lt;br /&gt;an 8-byte&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;value. Type safety also means that execution flow will only&lt;br /&gt;transfer to known&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;method entry points. There is no way to construct an arbitrary&lt;br /&gt;reference to a&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;memory location and cause code at that location to begin&lt;br /&gt;execution.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In addition, array indexes are checked to be sure they are in&lt;br /&gt;the range of the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;array. For example, if an object occupies 10 bytes in memory,&lt;br /&gt;the application&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;can’t change the object so that it will allow more than 10&lt;br /&gt;bytes to be read.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(11)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cross-language integration&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can write .NET applications in many different languages,&lt;br /&gt;such as C,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C++, Visual Basic, COBOL, Fortran, Perl, Pascal, Jscript, Lisp,&lt;br /&gt;Python,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Smalltalk, and others. Programmers can use the languages that&lt;br /&gt;they are&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;most proficient with to develop portions of an application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;All CLR-compliant languages compile to Common Intermediate&lt;br /&gt;Language&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(CIL). CIL is the key to making the .NET application&lt;br /&gt;platform-neutral and&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;hardware independent.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In addition, programmers can choose specific languages for&lt;br /&gt;specific tasks&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;within the same application. Some languages are stronger than&lt;br /&gt;others for&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;particular tasks, and programmers can choose the language best&lt;br /&gt;suited for&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;the task. The originating language doesn’t matter, because&lt;br /&gt;all .NETcompliant&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;compilers produce CIL.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Platform-neutrality&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A managed .NET application can execute on any Windows platform&lt;br /&gt;that&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;supports the .NET common language runtime. Currently, these&lt;br /&gt;platforms are&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Windows 98, Windows 2000, Windows Me, Windows NT, Windows XP,&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Windows Server 2003 (32-bit). Support for the .NET Framework&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Common Language Runtime on Windows Server 2003 (64-bit) is&lt;br /&gt;planned for&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;an upcoming release.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In addition, with the Microsoft Mobile Internet Toolkit,&lt;br /&gt;developers can create a&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.NET compliant, mobile Web application that can be adapted to&lt;br /&gt;the display of&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;multiple wireless devices. (6)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Security&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Managed code does not have direct access to memory, machine&lt;br /&gt;registers, or&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;pointers. The .NET Framework security enforces security&lt;br /&gt;restrictions on&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;managed code that protects the code and data from being misused&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;damaged by other code. An administrator can define a security&lt;br /&gt;policy to grant&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;or revoke permissions on an enterprise, a machine, an assembly,&lt;br /&gt;or a user&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;level. For these reasons, applications that use managed code are&lt;br /&gt;much&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;safer.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Code access security&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Code access security lets the administrator specify which&lt;br /&gt;operations a piece&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;of code can perform, stopping inappropriate behavior before it&lt;br /&gt;can start. You&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;can configure a complex set of rules to:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Specify whether a code group can both read and write files&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Demand that the code’s callers have specific&lt;br /&gt;permissions&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Allow only callers from a particular organization or site to&lt;br /&gt;call the code&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Grant permissions to each assembly that is loaded&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Compare the granted permissions&lt;br /&gt;of every caller on the call stack at&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;runtime to the permissions that callers must have and which&lt;br /&gt;resources the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;code can access. (6)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The access privileges an administrator assigns depend in part on&lt;br /&gt;where the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;application is running. For example, by default, an application&lt;br /&gt;that runs from&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;the local computer has a higher level of trust and more&lt;br /&gt;privileges, such as&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;accessing the file system, than an application that is running&lt;br /&gt;from the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Internet.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Calling unmanaged code bypasses the .NET CLR security. An&lt;br /&gt;application&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;that calls unmanaged code doesn’t necessarily have a&lt;br /&gt;security problem—it&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;simply has an open door to the possibility of problems due to&lt;br /&gt;the functionality&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;of the unmanaged code that has direct access to memory or&lt;br /&gt;machine&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;registers, or uses pointers. Once the unmanaged code is being&lt;br /&gt;executed, the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CLR can no longer check it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Avoiding buffer overruns&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;One common type of attack attempts to make API methods operate&lt;br /&gt;out of&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;specification, causing a buffer overrun. This attack typically&lt;br /&gt;passes&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;unexpected parameters, such as an out-of-range index or offset&lt;br /&gt;value.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Managed code avoids the buffer overruns that trigger so many&lt;br /&gt;security&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;snafus.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Buffer overruns usually occur in programs written in languages&lt;br /&gt;such as C or&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C++, which do not check array bounds and type safety. If an&lt;br /&gt;application does&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;not check the validity of the destination buffer size and other&lt;br /&gt;parameters, the&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;copied data might overrun the buffer, overwriting the data in&lt;br /&gt;adjacent&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;addresses.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Buffer overruns are theoretically impossible in managed&lt;br /&gt;code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Summary&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Using 100% managed code gives you solid performance, improved&lt;br /&gt;security,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and fewer bugs. The CLR provides memory management and lifetime&lt;br /&gt;control&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;of objects, including scalability features and versioning. When&lt;br /&gt;you call&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;unmanaged code, you lose many of the valuable benefits of the&lt;br /&gt;.NET&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;environment.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;References&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1.&lt;br /&gt;Gentile, Sam. “Intro to Managed C++, Part 2: Mixing Managed&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Unmanaged Code.” The O’Reilly Network.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;http://www.ondotnet.com/lpt/a/3226&lt;br /&gt;&lt;08/20/2003&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Gray, Jan. “Writing Faster&lt;br /&gt;Managed Code: Know What Things Cost.”&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MSDN Library. http://msdn.microsoft.com/library/?url=/library/enus/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;dndotnet/html/fastmanagedcode.asp&lt;br /&gt;&lt;08/20/2003&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Gregory, Kate. “Managed,&lt;br /&gt;Unmanaged, Native: What Kind of Code Is&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This?” http://www.developer.com/net/cplus/print.php/2197621&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;08/20/2003&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4.&lt;br /&gt;Mariani, Rico. “Garbage Collector Basics and Performance&lt;br /&gt;Hints.” MSDN&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Library. April 2003.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;http://msdn.microsoft.com/library/default.asp?url=/library/enus/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;dndotnet/html/dotnetgcbasics.asp&lt;br /&gt;&lt;08/20/2003&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. McNaughton, Allan. “Boosting&lt;br /&gt;the Performance of Microsoft .NET.” MSDN&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Library.&lt;br /&gt;http://msdn.microsoft.com/library/default.asp?url=/library/enus/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;dndotnet/html/optimaldotnet.asp&lt;br /&gt;&lt;08/20/2003&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Microsoft Corporation.&lt;br /&gt;“Deployment Guide for the Microsoft Mobile Internet&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Toolkit.”&lt;br /&gt;http://msdn.microsoft.com/library/default.asp?url=/library/enus/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;dnmitta/html/deploymobilwebapp.asp?frame=true&lt;br /&gt;&lt;08/20/2003&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. Microsoft. “The Windows&lt;br /&gt;Server 2003 Application Environment.” MSDN&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Library.&lt;br /&gt;http://msdn.microsoft.com/library/default.asp?url=/library/enus/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;dnnetserv/html/windowsnetserver.asp&lt;br /&gt;&lt;08/20/2003&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8.&lt;br /&gt;Microsoft. .NET Framework Developer’s Guide .&lt;br /&gt;Microsoft .NET Framework&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SDK1.0. 2001.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. Noriskin, Gregor. “Writing&lt;br /&gt;High-Performance Managed Applications: A&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Primer.” MSDN Library.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;http://msdn.microsoft.com/library/default.asp?url=/library/enus/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;dndotnet/html/optimaldotnet.asp&lt;br /&gt;&lt;08/04/2003&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;10. Platt, David S. Introducing Microsoft .NET .&lt;br /&gt;Microsoft Press. Redmond, WA.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2001.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;11. Richter,&lt;br /&gt;Jeffrey. “Microsoft .NET Framework Delivers the Platform for&lt;br /&gt;an&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Integrated, Service-Oriented Web.” MSDN Magazine .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;http://msdn.microsoft.com/msdnmag/issues/0900/Framework/default.aspx&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;08/20/2003&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;12. Schanzer, Emmanuel. “Performance Tips and Tricks in&lt;br /&gt;.NET Applications.”&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MSDN Library.&lt;br /&gt;http://msdn.microsoft.com/library/default.asp?url=/library/enus/ &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-112600891915365305?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112600891915365305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112600891915365305'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/09/importance-of-using-managed-code-in.html' title='The Importance of Using Managed Code in .NET'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112589771016739959</id><published>2005-09-04T22:16:00.000-07:00</published><updated>2008-05-27T05:39:47.126-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Whidbey And Partial Classes : Kaushal Patel</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;One of the language enhancements in .NET 2.0—available in both VB.NET 2005 and C# 2.0—is support for partial classes. In a nutshell, partial classes mean that your class definition can be split into multiple physical files. Logically, partial classes do not make any difference to the compiler. During compile time, it simply groups all the various partial classes and treats them as a single entity.&lt;br /&gt;&lt;br /&gt;One of the greatest benefits of partial classes is that it allows a clean separation of business logic and the user interface (in particular the code that is generated by the visual designer). Using partial classes, the UI code can be hidden from the developer, who usually has no need to access it anyway. Partial classes will also make debugging easier, as the code is partitioned into separate files.&lt;br /&gt;&lt;br /&gt;In this article, I will examine the use of partial classes in more detail and discuss how Visual Studio 2005 makes use of partial classes.&lt;br /&gt;&lt;br /&gt;Using Partial Classes&lt;br /&gt;Listing 1 contains two class definitions written in VB.NET, with the second class definition starting with the partial keyword. Both class definitions may reside in two different physical files. Functionally, Listing 1 is equivalent to Listing 2.&lt;br /&gt;&lt;br /&gt;Listing 1&lt;br /&gt;'---File1.vb---&lt;br /&gt;Public Class Class1&lt;br /&gt;Public Sub method1()&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;File2.vb&lt;br /&gt;Partial Public Class Class1&lt;br /&gt;Public Sub method2()&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;End Class&lt;br /&gt;Listing 2&lt;br /&gt;'---File1.vb---&lt;br /&gt;Public Class Class1&lt;br /&gt;Public Sub method1()&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;Public Sub method2()&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;So, what are the uses for partial classes?&lt;br /&gt;&lt;br /&gt;Here are some good reasons to use partial classes:&lt;br /&gt;They allow programmers on your team to work on different parts of a class without needing to share the same physical file. While this is useful for projects that involve big class files, be wary: If you find your class file getting too large, it may well signal a design fault and refactoring may be required.&lt;br /&gt;The most compelling reason for using partial class is to separate your application business logic from the designer-generated code. For example, the code generated by Visual Studio 2005 for a Windows Form is kept separate from your business logic (we will discuss this in a later section). This will prevent developers from messing with the code that is used for the UI. At the same time, it will prevent you from losing your changes to the designer-generated code when you change the UI.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The "partial" keyword in VB.NET used to be called "expands" in pre-beta versions of Visual Studio 2005. &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Examining Partial Classes&lt;br /&gt;The following code sample shows the class definition of MyClass1. I declared all my properties in this file. To avoid confusion, I named my class file MyClass1.Properties.vb, in order to make it obvious that this file contains a properties definition.&lt;br /&gt;'---MyClass1.Properties.vb&lt;br /&gt;'---one of the classes need not have the Partial keyword&lt;br /&gt;Public Class MyClass1&lt;br /&gt;Private pX As Integer&lt;br /&gt;Private py As Integer&lt;br /&gt;Property x() As Integer&lt;br /&gt;Get&lt;br /&gt;Return pX&lt;br /&gt;End Get&lt;br /&gt;Set(ByVal value As Integer)&lt;br /&gt;pX = value&lt;br /&gt;End Set&lt;br /&gt;End Property&lt;br /&gt;Property y() As Integer&lt;br /&gt;Get&lt;br /&gt;Return py&lt;br /&gt;End Get&lt;br /&gt;Set(ByVal value As Integer)&lt;br /&gt;py = value&lt;br /&gt;End Set&lt;br /&gt;End Property&lt;br /&gt;End Class&lt;br /&gt;In another file, named MyClass1.Methods.vb, I provide the methods implementation of MyClass1. I used the Partial keyword to indicate that this definition should be combined with the original MyClass1 definition.&lt;br /&gt;'---MyClass1.Methods.vb&lt;br /&gt;'---must have the Partial keyword&lt;br /&gt;Partial Public Class MyClass1&lt;br /&gt;Private py As Integer&lt;br /&gt;&lt;br /&gt;Public Sub method1()&lt;br /&gt;' implementation here&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Public Sub method3(ByVal x As Integer, ByVal y As Integer)&lt;br /&gt;' implementation here&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Public Sub method2()&lt;br /&gt;' implementation here&lt;br /&gt;End Sub&lt;br /&gt;End Class&lt;br /&gt;In reality, you can mix and match properties and method definitions in any of the files, but for clarity it is a good idea to group properties definitions in one file and methods definitions in another. The usual rules of OO apply: If there is a method1 in both files, then both method1s must have unique signatures.&lt;br /&gt;&lt;br /&gt;The syntax of partial classes in VB.NET and C# differs slightly. The following shows the implementation of partial classes in C#:&lt;br /&gt;// In C#, the partial keyword must&lt;br /&gt;// appear in all class definitions&lt;br /&gt;public partial class MyClass1&lt;br /&gt;{&lt;br /&gt;public MyClass1()&lt;br /&gt;{&lt;br /&gt;//implementation here&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public partial class MyClass1&lt;br /&gt;{&lt;br /&gt;//implementation here&lt;br /&gt;}&lt;br /&gt;Besides the order in which the "partial" keyword is placed, the most significant difference is the strict enforcement of the use of the "partial" keyword in all partial classes in C#. It is mandatory, whereas in VB.NET, not all of the partial classes have to have the "partial" keyword. This has caused a significant amount of newsgroup discussion about the rationale for the difference. My advice is that you should always prefix partial classes with the "partial" keyword. At least this will give you a visual clue that part of the implementation of the class lies somewhere else, and it is definitely useful when it comes to debugging.&lt;br /&gt;&lt;br /&gt;While partial classes allow you to split the definition of a class into multiple files, you cannot mix languages. That is, all partial classes must be written in the same language. Besides using the "partial" keyword for classes, you can also use it for structures and interfaces.&lt;br /&gt;&lt;br /&gt;If your class implements multiple interfaces, it is a good idea to use partial classes to contain the implementation for each interface.&lt;br /&gt;&lt;br /&gt;Hide-protecting code is one of the best uses of partial classes; you can prevent mishaps and provide useful code-layer abstraction at the same time. In Visual Studio 2005, Microsoft uses partial classes to hide designer-generated code. For example, in Visual Studio .NET 2003, the designer-generated code for a Windows form is encapsulated within the region "Windows Form Designer generated code"Very often, developers will accidentally modify the code within this region and cause the form to display incorrectly.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In Visual Studio 2005 however, the designer-generated code is no longer visible in the Code View window (see Figure 2). Instead, it is hidden within Solution Explorer.&lt;br /&gt;&lt;br /&gt;To see the designer-generated code, go to Solution Explorer and click on the Show All Files button (see Figure 3). Under the name of the Windows form, you will see a file post fixed with the "Designer.vb" name. Double-clicking on Form1.Designer.vb will reveal the designer-generated code:&lt;br /&gt;Partial Public Class Form1&lt;br /&gt;Inherits System.Windows.Forms.Form&lt;br /&gt;&lt;br /&gt;&lt;system.diagnostics.debuggernonusercode()&gt;_&lt;br /&gt;Public Sub New()&lt;br /&gt;MyBase.New()&lt;br /&gt;&lt;br /&gt;'This call is required by the&lt;br /&gt;' Windows Form Designer.&lt;br /&gt;InitializeComponent()&lt;br /&gt;...&lt;br /&gt;Notice that the Form1.Designer.vb file appears under the Form1.vb file in Solution Explorer. This is a good way to represent the relationship between the two files. So what does Visual Studio do to represent this relationship? The answer lies in the .vbproj or .csproj (for C# projects) file. Open the file in Notepad and use Ctrl + F to locate the &lt;itemgroup&gt;element:&lt;br /&gt;...&lt;br /&gt;&lt;itemgroup&gt;&lt;br /&gt;&lt;compile include="Form1.vb"&gt;&lt;br /&gt;&lt;subtype&gt;Form&lt;/subtype&gt;&lt;br /&gt;&lt;/compile&gt;&lt;br /&gt;&lt;compile include="Form1.Designer.vb"&gt;&lt;br /&gt;&lt;dependentupon&gt;Form1.vb&lt;/dependentupon&gt;&lt;br /&gt;&lt;subtype&gt;Form&lt;/subtype&gt;&lt;br /&gt;&lt;/compile&gt;&lt;br /&gt;...&lt;br /&gt;As you can see, the &lt;dependentupon&gt;element indicates that Form1.Designer.vb is dependent on Form1.vb. So how is this information useful to us?&lt;br /&gt;&lt;br /&gt;Recall that earlier in this article I mentioned two partial classes, MyClass1.methods.vb and MyClass1.properties.vb. Assume that these two classes serve as a template and contain general-purpose functions (and you generally would not make changes to these two classes). You may add a third partial class to add business-specific functions. And so, it would be useful to hide the first two partial classes in Solution Explorer by modifying the .vbproj/.csproj file:&lt;br /&gt;&lt;itemgroup&gt;&lt;br /&gt;&lt;compile include="MyClass1.vb"&gt;&lt;br /&gt;&lt;subtype&gt;MyClass1&lt;/subtype&gt;&lt;br /&gt;&lt;/compile&gt;&lt;br /&gt;&lt;compile include="MyClass1.properties.vb"&gt;&lt;br /&gt;&lt;dependentupon&gt;MyClass1.vb&lt;/dependentupon&gt;&lt;br /&gt;&lt;subtype&gt;MyClass1&lt;/subtype&gt;&lt;br /&gt;&lt;/compile&gt;&lt;br /&gt;&lt;compile include="MyClass1.methods.vb"&gt;&lt;br /&gt;&lt;dependentupon&gt;MyClass1.vb&lt;/dependentupon&gt;&lt;br /&gt;&lt;subtype&gt;MyClass1&lt;/subtype&gt;&lt;br /&gt;&lt;/compile&gt;&lt;br /&gt;When the project is loaded in Visual Studio 2005, you should see the two partial classes hidden&lt;br /&gt;&lt;br /&gt;Unfortunately, at this moment you need to manually modify the project file in order to hide partial classes. Hopefully in the next beta Microsoft will build this function into Visual Studio. Or someone else will write a plugin for that.&lt;br /&gt;&lt;br /&gt;In this article, you have seen how to split the definitions of a class into multiple classes using the "partial" keyword. The greatest use of partial classes is undoubtedly the separation of UI and business logic. I am interested to know how else you may be using partial classes.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-112589771016739959?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112589771016739959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112589771016739959'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/09/whidbey-and-partial-classes-kaushal.html' title='Whidbey And Partial Classes : Kaushal Patel'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112566149109463657</id><published>2005-09-02T04:41:00.001-07:00</published><updated>2008-05-27T05:40:21.023-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Executing ASPX pages without a web server : Kaushal Patel</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;For the last couple of days, I?ve been writing about creating a standalone ASPX execution environment?a Windows Forms application that executes an ASP.NET page and displays the results in a Web Browser control.&lt;br /&gt;&lt;br /&gt;Because of the way the ASP libraries are written, this effectively requires either a couple of communicating but distinct assemblies or a strongly-named assembly in the Global Assembly Cache. In my project, I wrote two distinct assemblies, which worked. But I wondered if I could overcome this requirement, with the hope that I would learn a thing or two in the process. It took some code spelunking (and a venture beyond what is documented), but I succeeded on both fronts.&lt;br /&gt;&lt;br /&gt;The article that got me started on this project was Ted Neward?s "Hosting ASP.NET: Running an All-Managed HTTP Server," which I can?t recommend highly enough. Neward opted for the two assembly approach (or more exactly, the same assembly copied into two different directories). My code still retains a class from his example. But while he uses an ASP.NET function to spin up the app domain that the ASPX page runs in, I create mine from scratch.&lt;br /&gt;&lt;br /&gt;Here?s a little console app I created:&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Hosting;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Runtime.Remoting;&lt;br /&gt;using System.Globalization;&lt;br /&gt;namespace AspHostTest&lt;br /&gt;{&lt;br /&gt;public class MyExeHost : MarshalByRefObject&lt;br /&gt;{&lt;br /&gt;public void ProcessRequest(String page)&lt;br /&gt;{&lt;br /&gt;HttpWorkerRequest hwr =&lt;br /&gt;new SimpleWorkerRequest(page, null, Console.Out);&lt;br /&gt;HttpRuntime.ProcessRequest(hwr);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;class MyAspHost&lt;br /&gt;{&lt;br /&gt;public static object CreateApplicationHost(Type hostType, string virtualDir, string physicalDir)&lt;br /&gt;{&lt;br /&gt;if (!(physicalDir.EndsWith("\\")))&lt;br /&gt;physicalDir = physicalDir + "\\";&lt;br /&gt;string aspDir = HttpRuntime.AspInstallDirectory;&lt;br /&gt;string domainId = DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo).GetHashCode().ToString("x");&lt;br /&gt;string appName = (virtualDir + physicalDir).GetHashCode().ToString("x");&lt;br /&gt;AppDomainSetup setup = new AppDomainSetup();&lt;br /&gt;setup.ApplicationName = appName;&lt;br /&gt;setup.ConfigurationFile = "web.config"; // not necessary execept for debugging&lt;br /&gt;AppDomain ad = AppDomain.CreateDomain(domainId, null, setup);&lt;br /&gt;ad.SetData(".appDomain", "*");&lt;br /&gt;ad.SetData(".appPath", physicalDir);&lt;br /&gt;ad.SetData(".appVPath", virtualDir);&lt;br /&gt;ad.SetData(".domainId", domainId);&lt;br /&gt;ad.SetData(".hostingVirtualPath", virtualDir);&lt;br /&gt;ad.SetData(".hostingInstallDir", aspDir);&lt;br /&gt;ObjectHandle oh = ad.CreateInstance(hostType.Module.Assembly.FullName, hostType.FullName);&lt;br /&gt;return oh.Unwrap();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;MyExeHost myHost = (MyExeHost)CreateApplicationHost(typeof(MyExeHost),"/",Directory.GetCurrentDirectory());&lt;br /&gt;myHost.ProcessRequest("app.aspx");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;To compile it, open a Visual Studio .NET command prompt (or any other command prompt session with the C# compiler in the path) and run this command:&lt;br /&gt;&lt;br /&gt;csc /t:exe /r:System.Web.dll AppHostTest.cs&lt;br /&gt;Put the exe file in a directory with an ASPX file named app.aspx. Here?s the simple file I?ve used in my tests:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;h1 align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Hello, world.&lt;/span&gt;&lt;/h1&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Today is&lt;br /&gt;&lt;%= DateTime.Now %&gt;.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When you run AppHostTest.exe, you?ll see the raw html that the executed ASPX file creates.&lt;br /&gt;&lt;br /&gt;In addition to running this program, you can use VS.NET to debug right into the ASP.NET page. For this to work, you?ll have to instruct the ASP.NET classes to compile your code with debug symbols. You can do this by creating a file called web.config in the same directory. All this file needs to contain is the following XML:&lt;br /&gt;&lt;br /&gt;&lt;configuration&gt;&lt;br /&gt;&lt;system.web&gt;&lt;br /&gt;&lt;compilation debug="true"&gt;&lt;br /&gt;&lt;/SYSTEM.WEB&gt;&lt;br /&gt;&lt;/configuration&gt;&lt;br /&gt;&lt;br /&gt;To load the debugger, run this command from the same directory:&lt;br /&gt;&lt;br /&gt;devenv /debugexe AspHostText.exe&lt;br /&gt;Load the ASPX file with the Open/File? menu choice, set a breakpoint on a line of code, press F5, and you should see the debugger stop at that line.&lt;br /&gt;&lt;br /&gt;Okay. That was fun, but what exactly is going on in the code?&lt;br /&gt;&lt;br /&gt;What we?ve done is to create two classes. MyAspHost includes the Main method that runs the show and a static method I?ve called CreateApplicationHost. This latter method serves the same purpose (and takes the same parameters) as a static method of the same name in the System.Web.Hosting.ApplicationHost class. The ASP.NET method does more, and calls a lot of protected functions in the process.&lt;br /&gt;&lt;br /&gt;My method does the minimum that is required to get a simple ASPX page to execute, which is to create an app domain, create an object in the app domain, and return a reference to this object to the calling program (in the default app domain). That's essentially what the ASP.NET classes do, but I've left out what isn't absolutely necessary. (The domain ID and application name could be given simpler names, but I chose to use the same algorithm that ApplicationHost.CreateApplicationHost uses.)&lt;br /&gt;&lt;br /&gt;The other class in the file is the one that gets instantiated in the new app domain. All it does is create a System.Web.Hosting.SimpleWorkerRequest specifying the page to run and the output System.IO.TextWriter, then hand this request to a static method in the System.Web.HttpRuntime class, which does all the rest.&lt;br /&gt;&lt;br /&gt;Next week I?ll write about the documented way to do this same thing, but I should mention the difference between this code and the Kosher code. The salient difference (apart from all the other things I left out) is that the ASP.NET code sets up a PrivateBinPath for the new app domain so it looks for the assembly it creates in a bin directory below the virtual root is uses. This explains the need for the second assembly?ASP.NET forces the Fusion assembly resolver to look for this assembly in a separate place. That?s what allows my code to be so simple; I allow Fusion to look for the new assemblies in the same directory as the executable. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style="font-size:78%;"&gt;Source : &lt;/span&gt;&lt;a href="http://radio.weblogs.com/0105476/stories/2002/07/12/executingAspxPagesWithoutAWebServer.html"&gt;&lt;span style="font-size:78%;"&gt;http://radio.weblogs.com/0105476/stories/2002/07/12/executingAspxPagesWithoutAWebServer.html&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-112566149109463657?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112566149109463657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112566149109463657'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/09/executing-aspx-pages-without-web_02.html' title='Executing ASPX pages without a web server : Kaushal Patel'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112566147602146596</id><published>2005-09-02T04:41:00.000-07:00</published><updated>2005-09-02T04:44:36.036-07:00</updated><title type='text'>Executing ASPX pages without a web server</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;For the last couple of days, I?ve been writing about creating a standalone ASPX execution environment?a Windows Forms application that executes an ASP.NET page and displays the results in a Web Browser control.&lt;br /&gt;&lt;br /&gt;Because of the way the ASP libraries are written, this effectively requires either a couple of communicating but distinct assemblies or a strongly-named assembly in the Global Assembly Cache. In my project, I wrote two distinct assemblies, which worked. But I wondered if I could overcome this requirement, with the hope that I would learn a thing or two in the process. It took some code spelunking (and a venture beyond what is documented), but I succeeded on both fronts.&lt;br /&gt;&lt;br /&gt;The article that got me started on this project was Ted Neward?s "Hosting ASP.NET: Running an All-Managed HTTP Server," which I can?t recommend highly enough. Neward opted for the two assembly approach (or more exactly, the same assembly copied into two different directories). My code still retains a class from his example. But while he uses an ASP.NET function to spin up the app domain that the ASPX page runs in, I create mine from scratch.&lt;br /&gt;&lt;br /&gt;Here?s a little console app I created:&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Hosting;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Runtime.Remoting;&lt;br /&gt;using System.Globalization;&lt;br /&gt;namespace AspHostTest&lt;br /&gt;{&lt;br /&gt;public class MyExeHost : MarshalByRefObject&lt;br /&gt;{&lt;br /&gt;public void ProcessRequest(String page)&lt;br /&gt;{&lt;br /&gt;HttpWorkerRequest hwr =&lt;br /&gt;new SimpleWorkerRequest(page, null, Console.Out);&lt;br /&gt;HttpRuntime.ProcessRequest(hwr);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;class MyAspHost&lt;br /&gt;{&lt;br /&gt;public static object CreateApplicationHost(Type hostType, string virtualDir, string physicalDir)&lt;br /&gt;{&lt;br /&gt;if (!(physicalDir.EndsWith("\\")))&lt;br /&gt;physicalDir = physicalDir + "\\";&lt;br /&gt;string aspDir = HttpRuntime.AspInstallDirectory;&lt;br /&gt;string domainId = DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo).GetHashCode().ToString("x");&lt;br /&gt;string appName = (virtualDir + physicalDir).GetHashCode().ToString("x");&lt;br /&gt;AppDomainSetup setup = new AppDomainSetup();&lt;br /&gt;setup.ApplicationName = appName;&lt;br /&gt;setup.ConfigurationFile = "web.config"; // not necessary execept for debugging&lt;br /&gt;AppDomain ad = AppDomain.CreateDomain(domainId, null, setup);&lt;br /&gt;ad.SetData(".appDomain", "*");&lt;br /&gt;ad.SetData(".appPath", physicalDir);&lt;br /&gt;ad.SetData(".appVPath", virtualDir);&lt;br /&gt;ad.SetData(".domainId", domainId);&lt;br /&gt;ad.SetData(".hostingVirtualPath", virtualDir);&lt;br /&gt;ad.SetData(".hostingInstallDir", aspDir);&lt;br /&gt;ObjectHandle oh = ad.CreateInstance(hostType.Module.Assembly.FullName, hostType.FullName);&lt;br /&gt;return oh.Unwrap();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;MyExeHost myHost = (MyExeHost)CreateApplicationHost(typeof(MyExeHost),"/",Directory.GetCurrentDirectory());&lt;br /&gt;myHost.ProcessRequest("app.aspx");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;To compile it, open a Visual Studio .NET command prompt (or any other command prompt session with the C# compiler in the path) and run this command:&lt;br /&gt;&lt;br /&gt;csc /t:exe /r:System.Web.dll AppHostTest.cs&lt;br /&gt;Put the exe file in a directory with an ASPX file named app.aspx. Here?s the simple file I?ve used in my tests:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;h1 align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Hello, world.&lt;/span&gt;&lt;/h1&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Today is&lt;br /&gt;&lt;%= DateTime.Now %&gt;.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When you run AppHostTest.exe, you?ll see the raw html that the executed ASPX file creates.&lt;br /&gt;&lt;br /&gt;In addition to running this program, you can use VS.NET to debug right into the ASP.NET page. For this to work, you?ll have to instruct the ASP.NET classes to compile your code with debug symbols. You can do this by creating a file called web.config in the same directory. All this file needs to contain is the following XML:&lt;br /&gt;&lt;br /&gt;&lt;configuration&gt;&lt;br /&gt;&lt;system.web&gt;&lt;br /&gt;&lt;compilation debug="true"&gt;&lt;br /&gt;&lt;/SYSTEM.WEB&gt;&lt;br /&gt;&lt;/configuration&gt;&lt;br /&gt;&lt;br /&gt;To load the debugger, run this command from the same directory:&lt;br /&gt;&lt;br /&gt;devenv /debugexe AspHostText.exe&lt;br /&gt;Load the ASPX file with the Open/File? menu choice, set a breakpoint on a line of code, press F5, and you should see the debugger stop at that line.&lt;br /&gt;&lt;br /&gt;Okay. That was fun, but what exactly is going on in the code?&lt;br /&gt;&lt;br /&gt;What we?ve done is to create two classes. MyAspHost includes the Main method that runs the show and a static method I?ve called CreateApplicationHost. This latter method serves the same purpose (and takes the same parameters) as a static method of the same name in the System.Web.Hosting.ApplicationHost class. The ASP.NET method does more, and calls a lot of protected functions in the process.&lt;br /&gt;&lt;br /&gt;My method does the minimum that is required to get a simple ASPX page to execute, which is to create an app domain, create an object in the app domain, and return a reference to this object to the calling program (in the default app domain). That's essentially what the ASP.NET classes do, but I've left out what isn't absolutely necessary. (The domain ID and application name could be given simpler names, but I chose to use the same algorithm that ApplicationHost.CreateApplicationHost uses.)&lt;br /&gt;&lt;br /&gt;The other class in the file is the one that gets instantiated in the new app domain. All it does is create a System.Web.Hosting.SimpleWorkerRequest specifying the page to run and the output System.IO.TextWriter, then hand this request to a static method in the System.Web.HttpRuntime class, which does all the rest.&lt;br /&gt;&lt;br /&gt;Next week I?ll write about the documented way to do this same thing, but I should mention the difference between this code and the Kosher code. The salient difference (apart from all the other things I left out) is that the ASP.NET code sets up a PrivateBinPath for the new app domain so it looks for the assembly it creates in a bin directory below the virtual root is uses. This explains the need for the second assembly?ASP.NET forces the Fusion assembly resolver to look for this assembly in a separate place. That?s what allows my code to be so simple; I allow Fusion to look for the new assemblies in the same directory as the executable. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align="justify"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style="font-size:78%;"&gt;Source : &lt;/span&gt;&lt;a href="http://radio.weblogs.com/0105476/stories/2002/07/12/executingAspxPagesWithoutAWebServer.html"&gt;&lt;span style="font-size:78%;"&gt;http://radio.weblogs.com/0105476/stories/2002/07/12/executingAspxPagesWithoutAWebServer.html&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-112566147602146596?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112566147602146596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112566147602146596'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/09/executing-aspx-pages-without-web.html' title='Executing ASPX pages without a web server'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112511735762747094</id><published>2005-08-26T21:31:00.000-07:00</published><updated>2008-05-27T05:41:06.031-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Comparison between J2EE and .NET</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;A Comparison between J2EE and .NET from Software Architectureâ€™s&lt;br /&gt;Perspective&lt;br /&gt;&lt;br /&gt;Abstract&lt;br /&gt;This paper compares two competing software technologies, J2EE and .NET from the&lt;br /&gt;perspective of software architecture. Both technologies aim at moving the software&lt;br /&gt;complexity away from the developers and letting them focus on the business logic. To&lt;br /&gt;achieve this end, both technologies provide a managed execution environment, a rich set&lt;br /&gt;of libraries, a method for uniform access to data, and an in-built support for backward&lt;br /&gt;compatibility. However, these two technologies take different approaches to meet these&lt;br /&gt;goals. This paper discusses the two approaches and their effect on non-functional&lt;br /&gt;requirements. In software architecture, the non-functional requirements are used to select&lt;br /&gt;the architecture that best suits the constraints of the application among different ones.&lt;br /&gt;This paper compares these two technologies based on the following non-functional&lt;br /&gt;requirements: Usability (how easy to use the technology), Security, Performance,&lt;br /&gt;Stability, Reusability, Comprehensibility, and User Documentation. Based on the&lt;br /&gt;discussion, it has been concluded that neither of the two is a clear winner. Hence that if&lt;br /&gt;one has a team of skilled programmers, with an existing business system using one&lt;br /&gt;technology, realistically it will be better to continue using that system, be it J2EE based&lt;br /&gt;or .NET based. &lt;/span&gt;&lt;/div&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;1. Introduction &lt;/u&gt;&lt;/div&gt;&lt;u&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;/u&gt;Large software systems are inherently complex. Developing and maintaining such large&lt;br /&gt;systems has always been a monumental task. With the advent of Internet, e-business&lt;br /&gt;became an indispensable aspect of a companyâ€™s success. Developing e-business solutions&lt;br /&gt;poses a new set of challenges for software development. Enterprise applications or ebusiness&lt;br /&gt;solutions generally run on heterogeneous networks and have to run on top of&lt;br /&gt;software developed by different vendors. They also involve the use of different network&lt;br /&gt;protocols. Under these constraints, enterprise applications have to satisfy the key&lt;br /&gt;requirements: High availability, Security, Reliability, and Scalability. It is easy to see the&lt;br /&gt;need for a managed environment or run time and a rich set of libraries to support&lt;br /&gt;development of enterprise applications.&lt;br /&gt;The two software giants, Microsoft and Sun, have come up with their own solution&lt;br /&gt;architecture to aid the development of enterprise applications. Microsoftâ€™s .NET is a&lt;br /&gt;framework with a rich set of libraries, a common language runtime and a more powerful&lt;br /&gt;and unified development environment. The alternative from Sun is J2EE. It is actually an&lt;br /&gt;open specification that specifies a set of technologies to solve the problems that arise in&lt;br /&gt;the development of enterprise applications. However, J2EE can also refer to all the&lt;br /&gt;technologies developed using Java. This paper discusses the runtime provided and their&lt;br /&gt;support for enterprise applications by these two technologies. Then it presents a&lt;br /&gt;comparison between these two technologies based on the following non-functional&lt;br /&gt;requirements: Security, Performance, Stability, Reusability, Comprehensibility and User&lt;br /&gt;Documentation.&lt;br /&gt;This paper is organized as follows. Section II and III provides a brief overview of .NET&lt;br /&gt;and J2EE respectively. Section IV discusses the support for runtime in these two&lt;br /&gt;technologies .Section V presents the e-business architecture of .NET and J2EE. Based on&lt;br /&gt;the non-functional requirements, each important aspect of .NET and JAVA are compared&lt;br /&gt;in Section VI. The conclusion is presented in Section VII.&lt;br /&gt;Keywords: .NET, J2EE, Comparison, Non functional Requirements&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;u&gt;2. .NET Overview&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;.NET delivers the infrastructure which can be leveraged to assemble solutions ranging&lt;br /&gt;from the desktop to the enterprise..NET is the amalgamation of the .NET framework, the&lt;br /&gt;basic building block services known as .NET My Services, which includes development&lt;br /&gt;tools such as Visual Studio.NET and infrastructure services provided by the .NET&lt;br /&gt;Enterprise Servers. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;2.1. .NET Framework&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;.NET Framework is the backbone of .NET. It can be broken down into three parts:&lt;br /&gt;Common Language Runtime (CLR), Class libraries, and Web Services and Internal&lt;br /&gt;System Services. It is a one-stop framework to build and deliver applications to any&lt;br /&gt;.NET Framework&lt;br /&gt;.NET My Services or Third&lt;br /&gt;Party Web Services&lt;br /&gt;.NET Enterprise Servers&lt;br /&gt;(SQL Server, Biz Talk, â€¦)&lt;br /&gt;Web Services&lt;br /&gt;Class Libraries&lt;br /&gt;Common Language Runtime (CLR)&lt;br /&gt;Operating System&lt;br /&gt;.NET Solutions&lt;br /&gt;Figure 1: .NET Overview&lt;br /&gt;device. The framework components provide various services to the applications. Some of&lt;br /&gt;the important services include providing I/O, providing UI elements for building web&lt;br /&gt;pages or traditional windows forms-based interfaces, handling data from disparate data&lt;br /&gt;sources using ADO.NET, ensuring application and system security, improving system&lt;br /&gt;stability by run time garbage collection and so forth. We will look at CLR, web services&lt;br /&gt;and .NET enterprise servers in detail in later sections. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;2.2 .NET Enterprise Servers&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;There are many enterprise servers written to help the development of enterprise&lt;br /&gt;applications. Some of the important enterprise servers are SQL Server 2000, BizTalk&lt;br /&gt;Server 200, Exchange Server 2000 and Internet Security and Acceleration Server 200. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;3. J2EE Overview&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;J2EE stands for Java 2 Enterprise Edition. It is the main competitor to .NET. J2EE is an&lt;br /&gt;open specification that defines a multi-tier architecture for developing enterprise&lt;br /&gt;applications. The enterprise architecture is described in section 5 and the other&lt;br /&gt;technologies are shown in the figure. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;3.1 J2EE Technologies &lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;The J2EE provides the APIs for integrating different applications and accessing&lt;br /&gt;databases. The following are the different APIs and their functionality. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;3.1.1 HTTP&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;The Http client-side API is defined by the java.net package. The http server-side API is&lt;br /&gt;defined by the servlets and JSP interfaces. These application-programming interfaces are&lt;br /&gt;used for establishing an http connection between the client and the server.&lt;br /&gt;J2EE Solutions&lt;br /&gt;J2EE Technologies&lt;br /&gt;JSP, Servlets JTA Java Mail&lt;br /&gt;Java Beans J NDI Java IDL&lt;br /&gt;Enterprise Java Beans JAAS JavaRMI&lt;br /&gt;JDBC JMS JAX-RPC&lt;br /&gt;Operating System&lt;br /&gt;Figure 2: J2EE Overview &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;3.1.2 Java Transaction API (JTA) &lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;This application programming interfaces are used for creating, and maintaining a secured&lt;br /&gt;transaction between the client and the server. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;3.1.3 Java IDL&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;JavaIDL allows J2EE application components to invoke external CORBA objects using&lt;br /&gt;the IIOP protocol. These CORBA object may be written in any language. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;3.1.4 Java Database Connectivity (JDBC)&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;The java database application interface provides connectivity to different relational&lt;br /&gt;databases. They provide excellent features to connect to different databases. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;3.1.5 Java Message Service (JMS)&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;The Java Message Service is a standard API for messaging that supports reliable point-topoint&lt;br /&gt;messaging. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;3.1.6 Java Naming and Directory Interface (JNDI) &lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;The JNDI API is the standard API for naming and directory access. The JNDI API&lt;br /&gt;provides interfaces to the application components to access naming and directory&lt;br /&gt;services. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;3.1.7 Java API for XML-based RPC (JAX- RPC) &lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;J2EE uses the Java API for XML-based RPC (JAX-RPC) to support web services. Web&lt;br /&gt;services can be implemented as a separate Java application using JAX-RPC or it can be&lt;br /&gt;an enterprise java bean (EJB) wrapped using JAX-RPC. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;4. Runtime&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;Runtime is an execution environment upon which software runs. Runtime generally&lt;br /&gt;makes operating system services such as starting up and stopping threads available to the&lt;br /&gt;programs executed. Depending on the runtime, it might also manage memory, enforce&lt;br /&gt;security policies, manage file access and determine how programs behave and interact&lt;br /&gt;with each other. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;4.1 .NET&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;One of the more technical aspects of .NET by definition is the Common Language&lt;br /&gt;Runtime (CLR). The various components of CLR include the common type system&lt;br /&gt;(CTS), common language specification (CLS), the garbage collector, just-in time&lt;br /&gt;compiling and security. The common type system and the common language&lt;br /&gt;specification are the two parts of the two-pronged attack of .NET for making crosslanguage&lt;br /&gt;compatible. The CLR is capable of executing programs written using any&lt;br /&gt;language that meets its common language specification. There are many .NET compliant&lt;br /&gt;languages already available in the industry. Some of them are Jscript.net, C#, Managed&lt;br /&gt;C++, VB.net, and Eiffel.net. The security features will be discussed in a separate section. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;4.2 J2EE&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;The runtime in J2EE is the Java Virtual Machine (JVM). Java is the only high-level&lt;br /&gt;language supported by J2EE. Java is compiled to Java Byte Code which the JVM (Java&lt;br /&gt;Virtual Machine) interprets. The JVM also does garbage collection and security&lt;br /&gt;checking. JVM makes J2EE platform neutral since JVM is available on almost all&lt;br /&gt;platforms. Thus the Java code once written can be executed on any platform. This is one&lt;br /&gt;of the important reasons behind Javaâ€™s success. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;5. Enterprise Application Development&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;Building an enterprise application has come a long way from the days of writing static&lt;br /&gt;HTML pages to complex online transaction management. Enterprise computing has a&lt;br /&gt;reputation for complexity .The complexity stems from the fact that enterprise applications&lt;br /&gt;run on heterogeneous networks and have to run on top of software developed by different&lt;br /&gt;vendors and also involves the use of different network protocols. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;5.1 .NET&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;.NET provides an evolutionary step toward building Web-based applications with the&lt;br /&gt;introduction of ASP.NET. This is an enhancement of Active Server Page (ASP)&lt;br /&gt;technology and, among other things, it introduces a new way to create Web forms. The&lt;br /&gt;most significant change to ASP is the technique called Code Behind, which makes it&lt;br /&gt;possible to separate user interface and business logic. The access to data is through a set&lt;br /&gt;of classes called ADO.NET. This provides a uniform access to the data from enterprise&lt;br /&gt;servers. The technologies ASP.NET and ADO.NET have simplified the development of&lt;br /&gt;enterprise applications. A simple architecture diagram is shown in the figure below.&lt;br /&gt;Client Tier&lt;br /&gt;Web Clients such as browsers&lt;br /&gt;Presentation Tier&lt;br /&gt;ASP.Net, Web forms&lt;br /&gt;Business Tier&lt;br /&gt;ADO.NET&lt;br /&gt;Data Tier&lt;br /&gt;Enterprise Servers such as SQL Servers, Exchange Servers&lt;br /&gt;&lt;br /&gt;&lt;u&gt;5.2 J2EE&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;J2EE architecture contains client tier, web tier, business tier and EIS tier. The figure 2&lt;br /&gt;below gives the complete details of each tier. Note that this figure shows the logical&lt;br /&gt;relationships of the elements. It is not meant to imply a physical partitioning of the&lt;br /&gt;elements into separate machines, processes, address spaces, or virtual machines.&lt;br /&gt;The J2EE application is divided into client tier, web tier, and enterprise information&lt;br /&gt;system. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;5.2.1 Client Tier &lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;The client tier is the application that is located on the client machine and it provides the&lt;br /&gt;user interface. The client can be Applet Client or Application Client. The applet is a GUI&lt;br /&gt;application that typically executes in web browsers. The applet client can provide a GUI&lt;br /&gt;to the user. Note that applet client can also be a simple HTML page that is presented to&lt;br /&gt;the user. The application client is an independent client application program that is&lt;br /&gt;developed using more sophisticated GUI environments like swing and awt of JAVA. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;5.2.2 Web Tier&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;Client Tier&lt;br /&gt;Applet Client&lt;br /&gt;HTML, XML&lt;br /&gt;Application&lt;br /&gt;Client&lt;br /&gt;Web Tier&lt;br /&gt;Business Tier&lt;br /&gt;Enterprise Java Beans&lt;br /&gt;EIS Tier&lt;br /&gt;J2SE&lt;br /&gt;Database&lt;br /&gt;Management&lt;br /&gt;Systems&lt;br /&gt;JSP Servlets&lt;br /&gt;Connectors&lt;br /&gt;JAXP, JTA, JMS, Java Mail, JDBC&lt;br /&gt;Connectors&lt;br /&gt;JAXP, JTA, JMS, Java Mail, JDBC&lt;br /&gt;Enterprise&lt;br /&gt;Information System&lt;br /&gt;This uses JSP / Servlets to generate HTML pages to the client tier. This tier takes care of&lt;br /&gt;presentation of information. This tier occasionally uses Java beans for computations.&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;u&gt;5.2.3 Business Tier&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;The business tier consists of the business logic of the application. This tier combined with&lt;br /&gt;web tier acts as the middle ware of the application. This provides the J2EE the flexibility&lt;br /&gt;to integrate with legacy systems. This serves multiple clients using multithreading.&lt;br /&gt;5.2.4 Enterprise Information Systems&lt;br /&gt;These are the legacy systems of the enterprise. They contain the entire data of the&lt;br /&gt;enterprise. Any request from the client goes through the middleware and where it is&lt;br /&gt;passed to the enterprise information systems. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;6. Comparison based on Non-Functional Requirements &lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;6.1 Usability &lt;/u&gt;&lt;/div&gt;&lt;u&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;/u&gt;In the development of enterprise applications, J2EE has many advantages compared to&lt;br /&gt;.NET as J2EE was developed for that purpose. The containers available in the J2EE&lt;br /&gt;manage most of the system issues. Some of the important system issues that are worth&lt;br /&gt;mentioning are accessing data from DBMS, managing distributed system issues like&lt;br /&gt;Naming(JNDI), and remote method invocation(RMI ).This lets the application developers&lt;br /&gt;concentrate on the business logic. One more advantage of J2EE is the GUI based&lt;br /&gt;deployment tool which helps in packaging and deploying the enterprise java beans. .NET&lt;br /&gt;has one distinct advantage over J2EE. ASP.NET provides a way to separate code and&lt;br /&gt;user interface components. This is not possible using JSPs and Servlets.&lt;br /&gt;In the development of GUI applications, .NET is easier to use compared to J2EE. Visual&lt;br /&gt;Basic.NET (VB.NET) is a language which aids in rapid development of GUI&lt;br /&gt;applications. Moreover it is easy to use and does not require a highly skilled developer. In&lt;br /&gt;J2EE, Java Swing is used to develop GUI .Though it is a powerful package, it is not as&lt;br /&gt;easy as VB.NET and it requires highly skilled developers.&lt;br /&gt;The cross language compatibility of .NET offers users a variety of languages from which&lt;br /&gt;they can choose a language that best suits their application development. Even a single&lt;br /&gt;application can be written using multiple languages. Although this is a significant&lt;br /&gt;advantage, it has a downside too. Maintaining an application using multiple languages is&lt;br /&gt;difficult. If a person who developed a part of the application in a particular language&lt;br /&gt;leaves the company/project, then it might require high cost to replace that person. In&lt;br /&gt;J2EE, currently only Java is supported. Java is considered the pure language which can&lt;br /&gt;be used for developing all kinds of applications. Since all applications are developed in&lt;br /&gt;Java, it does not have the disadvantage mentioned for .NET. It is also possible to make&lt;br /&gt;J2EE cross language compatible. The Java byte Code is general enough and that a&lt;br /&gt;compiler can be written to convert any language to Java Byte code which can then be&lt;br /&gt;executed by a JVM.&lt;br /&gt;JVM is available in almost all different platforms. .NET is available only for windows&lt;br /&gt;related platforms. However, efforts are made to implement .NET in other platforms,&lt;br /&gt;especially Linux.&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;u&gt;6.2 Security&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;In the world of Internet, Security is a paramount issue. The success of enterprise&lt;br /&gt;computing and web services depends on how secure the application is. Both J2EE and&lt;br /&gt;.NET have strong mechanism for security. Both support HTTPS secure transactions. Both&lt;br /&gt;have the notion of identification, authentication of the user and access control associated&lt;br /&gt;for each user. Both have two types of security: one can be specified external to code and&lt;br /&gt;the other is specified in the code. We will see in detail how it is actually implemented in&lt;br /&gt;each technology.&lt;br /&gt;&lt;u&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;u&gt;.NET&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;In .NET there are two types of security used by the run time (CLR): Code Access&lt;br /&gt;Security and Role Based Security.&lt;br /&gt;The Code Access Security means that the runtime performs security checks before code&lt;br /&gt;is executed by analyzing the metadata and comparing the access requests to the system&lt;br /&gt;settings and during JIT compilation. For example, one important component of code&lt;br /&gt;access security is verifying that code is type-safe.&lt;br /&gt;The Role based security is similar in idea to the security used in Windows today. One can&lt;br /&gt;create roles and assign permissions to them.&lt;br /&gt;In addition, we can have different security policies. A security policy is the set of rules&lt;br /&gt;that the CLR follows when determining if it should grant permission to code.&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;u&gt;J2EE&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;In J2EE, there are two types of security control: Programmatic Access Control and&lt;br /&gt;Declarative Access Control. To disallow an operation based on role or identification is&lt;br /&gt;called the declarative access control. Sometimes, it may be required to decide whether or&lt;br /&gt;not an operation can be allowed based on the data being manipulated. This can be&lt;br /&gt;handled by programmatic access control. In addition, JVM supports byte code&lt;br /&gt;verification and policy based security &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;6.3 Performance&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;In .NET, intermediate language (IL) is just-in-time (JIT) compiled to native code and&lt;br /&gt;executed. In J2EE, the Java byte code is interpreted by the JVM. Since interpreting is&lt;br /&gt;slower than executing native code, applications written on .NET perform better than&lt;br /&gt;J2EE applications. This result is published in the website (www.gotdotnet.com) based on&lt;br /&gt;some experiments. It has been said at various Java related websites that if Java byte code&lt;br /&gt;is just-in-time compiled, it performs better than C++ implementations. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;6.4 Stability&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;The stability of an application is improved if it does not lose memory due to memory&lt;br /&gt;leaks. Memory leak refers to a chunk of memory that has no reference in the code and&lt;br /&gt;was not freed. Both runtimes CLR and JVM include a garbage collector. A garbage&lt;br /&gt;collector removes memory leaks and thus increasing the stability of the application.&lt;br /&gt;6.5 Reusability&lt;br /&gt;Both technologies are based on Object Oriented methodologies. .NET framework has an&lt;br /&gt;in-built support for object orientation. Similarly since Java is an object oriented language,&lt;br /&gt;J2EE also supports object orientation. Object oriented methodology facilitates the reuse&lt;br /&gt;of code to a large extent. Hence both technologies are equally powerful with respect to&lt;br /&gt;reusability. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;6.6 Comprehensibility&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;Understanding the architectures of both J2EE and .NET involves a steep learning curve.&lt;br /&gt;This is because of the fact that they are huge and are composed of multiple different&lt;br /&gt;technologies. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;6.7 User Documentation&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;Excellent documentation and tutorials for all technologies related to J2EE are available at&lt;br /&gt;Sunâ€™s website. Microsoft also has a host of information about .NET on its developerâ€™s&lt;br /&gt;website.&lt;br /&gt;Since the comprehensibility of these technologies is difficult, it is prone to misuse. This&lt;br /&gt;can be avoided by providing the recommendations to utilize the technology in the best&lt;br /&gt;way. Sun has created Java Blueprints that contains recommendations for Java&lt;br /&gt;technologies. &lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;u&gt;7. Conclusion&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;&lt;div align="justify"&gt;This paper compared J2EE and .NET based on the non-functional requirements. From the&lt;br /&gt;discussion above, it is obvious that there is no clear winner. Each technology has its own&lt;br /&gt;advantages and disadvantages. Both technologies have support for backward&lt;br /&gt;compatibility. So, it is concluded that if one has a team of skilled programmers, with an&lt;br /&gt;existing business system using one technology, realistically it will be better to continue&lt;br /&gt;using that system, be it J2EE based or .NET based. &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-112511735762747094?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112511735762747094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112511735762747094'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/08/comparison-between-j2ee-and-net.html' title='Comparison between J2EE and .NET'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112480404740894318</id><published>2005-08-23T06:30:00.000-07:00</published><updated>2008-05-27T05:42:13.461-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Saving an embedded resource xml file at runtime in C#</title><content type='html'>&lt;span style="font-family:verdana;font-size:85%;"&gt;I couldn't find a cut &amp;amp; dry solution to this (probably b/c it's too simple for anyone to think they would need an example) so here's how I got an xml file embedded as a resource in a vs2003 project written to the filesystem.&lt;br /&gt;&lt;br /&gt;First, you just add an xml file with some default information you want for it to your project and change its build action to Embedded Resource. Then, you find the name of the resource (it can be tricky if you have a few folders) by opening up ildasm and double clicking the MANIFEST node. Using that resource name, you would do something like this:&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Xml;&lt;br /&gt;using System.Reflection;&lt;br /&gt;string path = Path.Combine(&lt;br /&gt;Environment.GetFolderPath(&lt;br /&gt;Environment.SpecialFolder.ApplicationData),&lt;br /&gt;Application.CompanyName);&lt;br /&gt;path = Path.Combine(path, Application.ProductName);&lt;br /&gt;path = Path.Combine(path, subFolder);&lt;br /&gt;path = Path.Combine(path, "fileName.xml");&lt;br /&gt;if(!File.Exists(path)){&lt;br /&gt;Assembly thisAssembly = Assembly.GetExecutingAssembly();&lt;br /&gt;Stream rgbxml = thisAssembly.GetManifestResourceStream(&lt;br /&gt;"YourNamespace.fileName.xml");&lt;br /&gt;XmlDocument doc = new XmlDocument();&lt;br /&gt;doc.Load(rgbxml);&lt;br /&gt;doc.PreserveWhitespace = true;&lt;br /&gt;doc.Save(path);&lt;br /&gt;} &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/11841833-112480404740894318?l=kaushalp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112480404740894318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11841833/posts/default/112480404740894318'/><link rel='alternate' type='text/html' href='http://kaushalp.blogspot.com/2005/08/saving-embedded-resource-xml-file-at.html' title='Saving an embedded resource xml file at runtime in C#'/><author><name>Kaushal A. Patel</name><uri>http://www.blogger.com/profile/16790849985072998562</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-11841833.post-112227531094958342</id><published>2005-07-25T00:05:00.000-07:00</published><updated>2008-05-27T22:12:06.395-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET'/><title type='text'>Programming Indigo: The Programming Model</title><content type='html'>&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;In Chapter 2, you learned about the fundamental concepts behind Indigo. Now it's time to introduce you to the programming model. The best way to learn a platform is to use it, so let's plunge in and start writing some code. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;After completing this chapter, you will:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Know how to set up Indigo on your computers.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Be familiar with the development process.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Understand the Indigo programming model.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Have created your first "Hello, world" Indigo programs.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 class="dtH1" align="justify"&gt;&lt;a name="progindig3_topic1"&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Setting Up for Indigo&lt;/span&gt;&lt;/h2&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;To set up for Indigo development, you must install Indigo and its prerequisites. Indigo is part of WinFX, the Microsoft Windows managed code development framework. You need all of the following to program with Indigo:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;An operating system that supports Indigo&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Microsoft .NET Framework 2.0&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Windows Application Pack (WAP)&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;A development environment&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;If you have WAP and Microsoft Visual Studio 2005 installed, you already have all of the preceding items.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Supported Operating Systems&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Indigo is part of the Microsoft "Longhorn" wave of technologies and will be included with future versions of Windows. As of this writing, you can also use Indigo with all editions of the following earlier operating systems:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Windows XP SP2 &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Microsoft Windows Server 2003 &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Indigo is not compatible with versions of Windows earlier than these. You can check which version of Windows a computer is running by opening System in Control Panel. The Windows version is displayed on the General tab.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;blockquote class="dtBlock"&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Caution&lt;/b&gt; The version and edition of Windows that you use might limit the communication functionality of your programs. For example, Windows XP Home and Professional Editions limit simultaneous connections from other computers to 5 and 10, respectively.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;.NET Framework 2.0&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Indigo requires the .NET Framework 2.0. If the framework is not present on your operating system, you can download it from Microsoft at &lt;i&gt;http://msdn.microsoft.com/netframework. &lt;/i&gt;Another way to obtain the .NET Framework is to install Visual Studio 2005 as your development environment. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;If you're not sure what version of the .NET Framework is on your computer, you can find out by opening Add Or Remove Programs in Control Panel. If you don't see Microsoft .NET Framework 2.0 listed, you need to install the framework.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;While installing the framework, you can also install the MSDN documentation library, which is highly recommended. This book assumes that you have access to both the .NET Framework documentation and the MSDN documentation.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Windows Application Pack&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Indigo is part of WinFX, the managed code framework for Windows development. It includes Indigo as well as other technologies. WinFX will be included with the "Longhorn" edition of Windows but is also available as a download for supported operating systems as part of WAP.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You can check whether WAP is installed (and its version, if it is installed) by opening Add Or Remove Programs in Control Panel and examining the list of installed software. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;WAP can be downloaded from Microsoft at &lt;/span&gt;&lt;a href="http://msdn.microsoft.com/webservices"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;http://msdn.microsoft.com/webservices&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Visual Studio .NET 2005&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The recommended environment for Indigo development is Visual Studio .NET 2005. Visual Studio provides unparalleled support for Web, desktop, and device development in multiple languages. Its integrated development environment (IDE) includes a full-featured code editor, Microsoft IntelliSense, visual designers, and visual debugging. Visual Studio is integrated with Indigo, providing a rich and seamless development experience.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 class="dtH1" align="justify"&gt;&lt;a name="progindig3_topic2"&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The Development Process&lt;/span&gt;&lt;/h2&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Solution development in Indigo combines traditional elements of object-oriented programming with some new considerations. The chief skill you need is the ability to think in a service-oriented manner. To enjoy the benefits discussed in Chapter 1, you should avoid design decisions that violate the tenets of service orientation (SO).&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Service Design&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;To design a service properly, you must take into account its role in relation to other services. Some key questions to answer include the following:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Does your service have a well-defined role as part of a distributed solution?&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;What are the target audiences for your service? Who will be consuming it?&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;What dependencies does your service have? What other services will your service access?&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;What boundaries will be crossed to access your service, and what are the implications?&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;What contracts and schemas should your service implement? &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;What message exchange patterns should your service support?&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;What are your service's security requirements?&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;What are your service's interoperability requirements?&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;If you can answer these questions concretely, you are ready to begin designing your service.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;A fundamental part of service design is determining contracts. Service contracts describe the operations a service can perform. Data contracts define information structures passed to and from service operations. Message contracts customize the organization of messages, which might be necessary for interoperability. You must define contracts, bindings, and endpoints for the services you create, and you must be aware of the contracts, bindings, and endpoints of other services you plan to access.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Development Approach&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Developers can choose which part of a service to create first, the code or the contract. In the &lt;b&gt;code-first &lt;/b&gt;approach, the service implementation code is written before the metadata (WSDL and XSD) is created. In the &lt;b&gt;contract-first &lt;/b&gt;approach, the metadata is the starting point and the code follows. Each approach has its implications. Developers willing to work at a lower level have a third option, contractless or late-bound development.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Code-First Development&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;In the code-first approach, you begin by writing the implementation code for your service. The contract results from how you write your code. Once your code is complete, you can generate metadata describing your service. The metadata can be provided live by the service itself through a metadata exchange (MEX) endpoint, or you can create WSDL and XSD files from the service.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Not all class types can be converted to XSD schema, which illustrates one disadvantage of the code-first approach: if you choose types carelessly, you might prevent a smooth transition to WSDL and then XSD. You can find out more about Indigo conversions between types and XSD in Chapter 5.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Contract-First Development&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;In the contract-first approach, you begin with service metadata (WSDL and XSD) and the code follows. You might be implementing the service itself or creating a client to access the service. In either case, you can generate code from the service metadata, which then gives you a big helping hand in writing your program. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You can obtain service metadata in several ways. Ideally, you can retrieve metadata from a running service's MEX endpoint. Alternatively, you can obtain WSDL and XSD files via the Web or e-mail.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Contractless or Late-Bound Development&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Another choice for developers is to not bother with contracts at all. You can choose this route if you are willing to work directly with messages. If your service operations just send and receive messages, Indigo does not have to make assumptions about the kind of messages your service works with. This requires your programs to work at a lower level than is usually necessary. You have to create messages to send and interpret messages that are received. You might use this technique for a service that accepts any kind of message for processing, such as a router.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Code Generation: The Svcutil Tool&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Whether you use code-first or contract-first development, you can benefit from code generation. Most developers find metadata such as WSDL and XSD complex and cumbersome to work with directly, so it's desirable to have tools to read or write this information. Indigo provides a command-line tool named Svcutil that imports and exports service metadata. Svcutil can:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Generate program code from service metadata retrieved from a running service's MEX endpoint.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Generate program code from service metadata read from WSDL and XSD files.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Generate service metadata WSDL and XSD files from a service assembly.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Svcutil has quite a few command-line options. Run &lt;i&gt;svcutil /? &lt;/i&gt;for a list of them. You can also find a Svcutil reference in Appendix D, which is downloadable from the Web, as described in the Introduction.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Generating Program Code from a MEX Endpoint&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Svcutil can read metadata from a service's MEX endpoint and generate program code. To generate code from a service's metadata, specify the MEX endpoint for the service on the Svcutil&lt;i&gt; &lt;/i&gt;command line. The MEX endpoint address for a service is usually the same as the services's HTTP base address or HTTP endpoint address.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;svcutil http://localhost/MyService&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The code generated contains the client's contracts and a proxy class for accessing the service. Code can be generated in a variety of programming languages, including C# and Microsoft Visual Basic .NET. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Generating Program Code from WSDL and XSD Files&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Svcutil can read metadata from WSDL and XSD files to generate program code. To generate code from a metadata file, specify the metadata file(s) for the service on the Svcutil&lt;i&gt; &lt;/i&gt;command line. You can specify multiple files and use wildcards.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;svcutil MyService.wsdl *.xsd&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The code generated contains the client's contracts and a proxy class for accessing the service. Again, you have a choice of languages.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Generating WSDL and XSD Files from a Service Assembly&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Once your service is compiled into a .NET assembly, Svcutil can generate metadata files from it. To generate WSDL and XSD files from a service assembly, specify the assembly file on the Svcutil command line:&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;svcutil MyService.dll&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Self-Describing Services &lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You can make a service self-describing by providing a MEX endpoint. This does not require the Svcutil tool. Metadata is provided live, on demand, by your running service.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Program Implementation&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Indigo is a managed code platform, so if you've ever programmed with .NET, you'll find yourself in familiar territory. Table 3-1 shows the primary Indigo namespaces and library assemblies. Your programs must reference these assemblies. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="label" align="justify"&gt;&lt;b&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Table 3-1 Indigo Namespaces and References&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;table class="data"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tbody&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;th class="data" align="left" width="36%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Namespace&lt;/span&gt;&lt;/th&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;th class="data" align="left" width="39%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Assembly Reference&lt;/span&gt;&lt;/th&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;th class="data" align="left" width="25%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Description&lt;/span&gt;&lt;/th&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="36%"&gt;&lt;i&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;System.ServiceModel&lt;/span&gt;&lt;/i&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="39%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;System.ServiceModel.dll&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="25%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Core library&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="36%"&gt;&lt;i&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;System.Runtime.Serialization&lt;/span&gt;&lt;/i&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="39%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;System.Runtime.Serialization.dll&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="25%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Serialization library&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="36%"&gt;&lt;i&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;System.Security.Authorization&lt;/span&gt;&lt;/i&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="39%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;System.Security.Authorization.dll&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="25%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Security library&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="36%"&gt;&lt;i&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;System.Transactions&lt;/span&gt;&lt;/i&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="39%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;System.Transactions.dll&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="25%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Transaction library&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Indigo also includes a number of tools for such tasks as metadata import and export and viewing traces. Table 3-2 lists the tools.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="label" align="justify"&gt;&lt;b&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Table 3-2 Tool Programs&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;table class="data"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tbody&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;th class="data" align="left" width="37%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Tool&lt;/span&gt;&lt;/th&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;th class="data" align="left" width="63%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Description&lt;/span&gt;&lt;/th&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="37%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Comsvcutil.exe&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="63%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Configures COM+ integration with services&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="37%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Dc.exe&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="63%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Import/export tool for converting between data contract types and XML schema documents&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="37%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Svcutil.exe&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="63%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Import/export tool for converting between service metadata and code&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="37%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;TraceViewer.exe&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="63%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Management tool for viewing end-to-end traces and logged messages&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Indigo programming involves the use of an object model, declarative attributes, and configuration settings. Listings 3-1 and 3-2 show a small example of client code in which all three are in use. In this example, attributes are used to describe a service contract, objects are used to access the service, and the service endpoint and access method are specified in a configuration file rather than in the program itself.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Listing 3-1. &lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Example of Attributes and Object Model&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;using System;&lt;br /&gt;using System.ServiceModel;&lt;br /&gt;&lt;br /&gt;[ServiceContract]&lt;br /&gt;interface ITaxService&lt;br /&gt;{&lt;br /&gt;    [OperationContract]&lt;br /&gt;    double ComputeTax(double amount, double taxRate);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Client&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        using (TaxServiceProxy proxy = new TaxServiceProxy("DefaultEndpoint"))&lt;br /&gt;        {&lt;br /&gt;            double subtotal, tax, total;&lt;br /&gt;            subtotal = 1500.00D;&lt;br /&gt;            tax = proxy.ComputeTax(subtotal, 7.75D);&lt;br /&gt;            total = subtotal + tax;&lt;br /&gt;            proxy.Close();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Listing 3-2. &lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Example of Configuration Settings&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;&amp;lt;configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&amp;gt;&lt;br /&gt;    &amp;lt;system.serviceModel&amp;gt;&lt;br /&gt;        &amp;lt;client&amp;gt;&lt;br /&gt;            &amp;lt;endpoint&lt;br /&gt;                configurationName="DefaultEndpoint"&lt;br /&gt;                address="http://localhost/Tax/service.svc"&lt;br /&gt;                bindingSectionName="wsProfileBinding"&lt;br /&gt;                contractType="ITaxService" /&amp;gt;&lt;br /&gt;        &amp;lt;/client&amp;gt;&lt;br /&gt;    &amp;lt;/system.serviceModel&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;As for where to put your code and what it compiles to, you have some choices. You can host your service in Internet Information Services (IIS), or you can write a small amount of extra code to host a service yourself. You can self-host a service from just about any environment that supports managed code, including a WinForms application, console application, library assembly (DLL), or Microsoft Windows NT Service. We'll talk more about this shortly.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Debugging Applications&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Connected applications can be more challenging to test and debug than standalone applications, due to their distributed nature. Indigo provides two features to help with these tasks: end-to-end tracing and message logging.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;End-to-end tracing results in a log of a service's activities. With a trace log, you can follow the sequence of events as services interact. You enable and control end-to-end tracing through a program's configuration file. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Message logging involves storing copies of messages for your inspection as XML files on disk. You enable message logging in an application's configuration file. Listing 3-3 shows a logged message.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Listing 3-3. &lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;A Logged Message&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&amp;lt;MessageTraceRecord Time="05/28/2004 22:05:11"&lt;br /&gt;ChannelType="System.ServiceModel.Channels.HttpChannelProviderBase+HttpRequestChannel"&lt;br /&gt;xmlns="http://schemas.microsoft.com/mb/2002/07/management/messagetrace"&amp;gt;&lt;br /&gt;  &amp;lt;s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"&amp;gt;&lt;br /&gt;   &amp;lt;s:Header /&amp;gt;&lt;br /&gt;    &amp;lt;s:Body xmlns:s="http://www.w3.org/2003/05/soap-envelope"&amp;gt;&lt;br /&gt;      &amp;lt;amount xmlns=""&amp;gt;752.00&amp;lt;/amount&amp;gt;&lt;br /&gt;      &amp;lt;accountNumber xmlns=""&amp;gt;441234435312324&amp;lt;/accountNumber&amp;gt;&lt;br /&gt;      &amp;lt;expDate xmlns=""&amp;gt;01/07&amp;lt;/expDate&amp;gt;&lt;br /&gt;      &amp;lt;nameOnAccount xmlns=""&amp;gt;JOHN Q PUBLIC&amp;lt;/nameOnAccount&amp;gt;&lt;br /&gt;    &amp;lt;/s:Body&amp;gt;&lt;br /&gt;  &amp;lt;/s:Envelope&amp;gt;&lt;br /&gt;&amp;lt;/MessageTraceRecord&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You can relate events in the end-to-end trace log to logged messages. A message correlation ID allows you to follow a message's route from one service to another.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You can learn more about these management features in Chapter 11.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Deploying Applications&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Indigo is hosting agnostic, which means you can write an Indigo program from any environment that supports managed code. The hosting environment you use generally has no effect on how you write code to create clients or services. As with other .NET code, you can put Indigo code into many kinds of programs and contexts, such as a console window program, a graphical WinForms application, a Windows NT service, or a Microsoft ASP.NET Web application. Both clients and services can be hosted this way. In each of these cases, you deploy your program in the usual manner. Configuration information is defined in an App.config or Web.config file. If you host in these environments, you must provide a few lines of code to create and start your service, for example:&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;ServiceHost&amp;lt;MyService&amp;gt; serviceHost = new ServiceHost&amp;lt;MyService&amp;gt;();&lt;br /&gt;serviceHost.Open();&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Another option is to host your services using IIS. In IIS hosting, your service doesn't have to be started up in advance; it is launched the first time an incoming message is received from it. In addition to automatic activation, hosting in IIS provides health monitoring and automatic process recycling in the event of unhandled exceptions. When your service is hosted in IIS, you don't have to write any hosting code.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Hosting in IIS is similar to working in ASP.NET. Applications are mapped to a virtual directory created in IIS Manager. An .svc file in the virtual directory describes the service. Your service code can either appear directly in the .svc file, where it is compiled on demand, or it can reside in an assembly. Hosting in IIS does not limit you to HTTP communication, but an Indigo listener service must be running for non-HTTP transports. You can find more information about IIS hosting in Chapter 10.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 class="dtH1" align="justify"&gt;&lt;a name="progindig3_topic3"&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The Programming Model&lt;/span&gt;&lt;/h2&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The Indigo programming model stresses unification, simplicity, and interoperability. The capabilities of predecessor communication technologies such as COM, DCOM, COM+, Enterprise Services, MSMQ, and .NET Remoting are united under a single programming model. The programming model is rich and capable yet simple to use. Because it is backed by a service-oriented runtime, what you develop with the programming model can interoperate with other platforms.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Reconciling Object Orientation and Service Orientation&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;In Chapter 1 we went to great lengths to draw distinctions between service orientation (SO) and object orientation (OO). You should use OO to build programs but use SO to connect programs. This raises the question of how SO and OO meet up and what that means to developers.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;In Indigo, objects are treated as first-class citizens. You define contracts and service implementations by writing interfaces and classes. Attributes are used to make the associations. Table 3-3 shows the relationship between SO and OO concepts in the programming model and the attributes that link them.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="label" align="justify"&gt;&lt;b&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Table 3-3 Relationship of SO Entities to OO Entities&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;table class="data"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tbody&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;th class="data" align="left" width="29%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;SO Entity&lt;/span&gt;&lt;/th&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;th class="data" align="left" width="27%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;OO Entity&lt;/span&gt;&lt;/th&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;th class="data" align="left" width="44%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Attribute&lt;/span&gt;&lt;/th&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="29%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Service contract&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="27%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;interface&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="44%"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;Annotate interface with &lt;i&gt;[ServiceContract]&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="29%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Service operation&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="27%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;method&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="44%"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;Annotate interface method with &lt;i&gt;[OperationContract]&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="29%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Implementation class&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="27%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;class&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="44%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Annotate class with &lt;i&gt;[ServiceBehavior] &lt;/i&gt;and derive from service contract interface&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="29%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Implementation method&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="27%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;method&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="44%"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;Annotate method with &lt;i&gt;[OperationBehavior]&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="29%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Data contract&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="27%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;class&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="44%"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;Annotate class with &lt;i&gt;[DataContract] &lt;/i&gt;and members with &lt;i&gt;[DataMember]&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;tr valign="top"&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="29%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Message contract&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="27%"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;interface&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;td class="data" width="44%"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;Annotate service or data contracts with &lt;i&gt;[MessageContract] &lt;/i&gt;and members with &lt;i&gt;[MessageHeader]&lt;/i&gt; and &lt;i&gt;[MessageBody]&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tr&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;To get a sense of this, study the following C# code, which defines a service contract by annotating an interface with attributes. The developer defines something familiar, an interface. Attributes relate the interface to a service contract and its methods to service operations.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;    [ServiceContract]&lt;br /&gt;    public interface IStockTrading&lt;br /&gt;    {&lt;br /&gt;        [OperationContract]    bool Buy(string symbol, int shares);&lt;br /&gt;     [OperationContract]    bool Sell(string symbol, int shares);&lt;br /&gt;    }&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Similarly, the implementation code for the service can be defined as a class that implements the interface, again using attributes. An attribute identifies the class as a service implementation class.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;    [ServiceBehavior]&lt;br /&gt;    public class StockTrading : IStockTrading&lt;br /&gt;    {&lt;br /&gt;        [OperationBehavior]&lt;br /&gt;        public bool Buy(string symbol, int shares)&lt;br /&gt;        {&lt;br /&gt;            ...implementation...&lt;br /&gt;        }&lt;br /&gt;        [OperationBehavior]&lt;br /&gt;     public bool Sell(string symbol, int shares)&lt;br /&gt;        {&lt;br /&gt;            ...implementation...&lt;br /&gt;        }&lt;br /&gt;    }&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;This SO-to-OO mapping makes things convenient for the developer. Interfaces and classes are familiar entities from the object-oriented world. Annotating them with attributes defines corresponding entities in the service-oriented world. Using generated code from the Svcutil tool, a client can access this service's operations in an object-like manner:&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;StockTradingProxy proxy = new StockTradingProxy();&lt;br /&gt;proxy.Buy("MSFT", 100);&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;This fusion of SO and OO means developers can use a paradigm they're already used to—object orientation—yet still enjoy all of the benefits of service orientation. Despite the familiar look of the code, what's sent over the wire is interoperable messages, not objects. The use of attributes in contracts gives developers explicit control over what is exposed to other programs. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Programming Approaches&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The Indigo programming model supports three methods of programming:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Declarative programming, in which you specify attributes&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Imperative programming, in which you work with the Indigo object model in code&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Configuration-based programming, in which you specify behavior in application configuration files&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;This is not to say that everything in Indigo can be done in three ways, but there are quite a few things you can do in more than one way. To illustrate the versatility this gives you, consider the task of specifying an endpoint for a service, which can be done via configuration file settings or in code, as you prefer. Here's an endpoint defined in a configuration file:&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&amp;lt;endpoint&lt;br /&gt;    address="http://localhost:8000/MyService/"&lt;br /&gt;    bindingSectionName="wsProfileBinding"&lt;br /&gt;    contractType="IMyContract" /&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The same endpoint definition in code looks like this:&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;    serviceHost = new ServiceHost&amp;lt;MyService&amp;gt;();&lt;br /&gt;    serviceHost.AddEndpoint(typeof(IMyContract), new WSProfileBinding(),&lt;br /&gt;       "http://localhost:8000/MyService/");&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;If it's important to provide deployment-time control of the endpoint to IT deployment personnel, specifying an address in a configuration file is the way to go.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;These three programming approaches are not mutually exclusive. Developers can intermix attributes, the object model, and configuration files. In the appropriate chapters in this book, we'll identify the pertinent attributes, objects, and configuration settings.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Declarative Programming: Attributes&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Declarative attributes are used to define contracts and specify service behaviors. The following code shows a data contract in C#.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;    [DataContract]&lt;br /&gt;    public class Contact&lt;br /&gt;    {&lt;br /&gt;        [DataMember]    public string LastName;&lt;br /&gt;        [DataMember]    public string FirstName;&lt;br /&gt;        [DataMember]    public string Phone;&lt;br /&gt;        [DataMember]    public string Email;&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;blockquote class="dtBlock"&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Note&lt;/b&gt; Declarative attributes in C# take the form &lt;i&gt;[keyword] &lt;/i&gt;or &lt;i&gt;[keyword(param=value, …)]&lt;/i&gt;. They can appear on the same line or precede the statements they apply to.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The equivalent code looks like this in Visual Basic .NET:&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;    &amp;lt;DataContract&amp;gt; Public Class Contact&lt;br /&gt;        &amp;lt;DataMember&amp;gt;       Public LastName As String&lt;br /&gt;        &amp;lt;DataMember&amp;gt;       Public FirstName As String&lt;br /&gt;        &amp;lt;DataMember&amp;gt;       Public Phone As String&lt;br /&gt;        &amp;lt;DataMember&amp;gt;       Public Email As String&lt;br /&gt;End Class&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;blockquote class="dtBlock"&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Note&lt;/b&gt; Declarative attributes in Visual Basic .NET take the form &lt;i&gt;&amp;lt;keyword&amp;gt; &lt;/i&gt;or &lt;i&gt;&amp;lt;keyword(param:=value, …)&amp;gt;&lt;/i&gt;. If you want the attributes to appear on separate lines from the statements they apply to, you must indicate line continuation with the underscore character.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Attributes can specify parameters that modify details of their requirements or behavior. The following service contract specifies session requirements and service operation direction using parameters.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;[ServiceContract(Session=true)]&lt;br /&gt;public interface IStockTrading&lt;br /&gt;{&lt;br /&gt;    [OperationContract(IsOneWay=false)]&lt;br /&gt;    bool Buy(string symbol, int shares);&lt;br /&gt;    [OperationContract(IsOneWay=false)]&lt;br /&gt;    bool Sell(string symbol, int shares);&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;If you omit the parameters in an attribute, you must be aware of what they default to. By convention, Boolean parameters in attributes usually default to false.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You'll find a concise summary of attributes and parameters in Appendix B, which is downloadable from the Web, as described in the Introduction.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Imperative Programming: The Object Model&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The object model, or application programming interface (API), is the collection of classes and interfaces that provide developers with the deepest level of access to Indigo. With the object model, developers can use object-oriented programming to create and access services. Of the three forms of programming supported by Indigo, the object model is the most extensive. When you need the most granular level of control over Indigo, you should use the object model.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The object model is managed code. If you've ever programmed with .NET, you'll find yourself in familiar territory. The following code, which creates and starts a service, shows the object model at work.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;serviceHost = new ServiceHost&amp;lt;MyService&amp;gt;();&lt;br /&gt;serviceHost.AddEndpoint(typeof(IMyContract), new WSProfileBinding(),&lt;br /&gt;   "http://localhost:8000/MyService/");&lt;br /&gt;serviceHost.Open();&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Clients use the object model as well. Here a client creates a typed channel to a service using the object model and accesses the service.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;IOrderProcessing orderProcessingService = ChannelFactory.CreateChannel&lt;br /&gt;   &amp;lt;IOrderProcessing&amp;gt;(new EndpointAddress(uri), binding);&lt;br /&gt;string orderID = orderProcessingService.SubmitOrder(order);&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Client code is simplified if proxy code is generated using the Svcutil tool. A client can create a proxy this easily using generated code:&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;OrderProcessingProxy proxy = new OrderProcessingProxy("DefaultEndpoint");&lt;br /&gt;string orderID = proxy.SubmitOrder(order);&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Indigo has hundreds of classes, but application developers typically need to access only a small subset on a regular basis. The object model is described in the remaining chapters of this book. You'll find a summary of the object model classes of interest to application developers in Appendix A, which is downloadable from the Web, as described in the Introduction. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Configuration-Based Programming&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Configuration-based development permits part of an application's behavior to be specified in configuration files. You can make such things as addresses, bindings, security details, service behavior, and tracing changeable without having to modify and recompile the program code. The following application configuration file defines a service endpoint.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&amp;lt;configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&amp;gt;&lt;br /&gt;    &amp;lt;system.serviceModel&amp;gt;&lt;br /&gt;        &amp;lt;services&amp;gt;&lt;br /&gt;            &amp;lt;service serviceType="SampleService"&amp;gt;&lt;br /&gt;                &amp;lt;endpoint&lt;br /&gt;                    address=http://localhost:8000/SampleService/&lt;br /&gt;                    bindingSectionName="basicProfileBinding"&lt;br /&gt;                    contractType="ISampleContract, service" /&amp;gt;&lt;br /&gt;            &amp;lt;/service&amp;gt;&lt;br /&gt;        &amp;lt;/services&amp;gt;&lt;br /&gt;    &amp;lt;/system.serviceModel&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt; &lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;By specifying addresses, bindings, and behaviors in a configuration file, you can make deploy-time decisions about services that don't require any modification to the service programs themselves. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Configuration settings are described in the remaining chapters of this book. You'll find a concise list of configuration settings in Appendix C, which is downloadable fronm the Web, as described in the introduction.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Order of Precedence in Indigo&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You might be wondering who "wins" if declarative, imperative, and configuration-based programming are used in contradictory ways. For example, what happens if the same endpoint is defined in more than one place? Here's the order of precedence in Indigo:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;ol&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Attributes are applied.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Configuration settings are applied (possibly overriding some definitions).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Code executes (possibly overriding some definitions).&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ol&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 class="dtH1" align="justify"&gt;&lt;a name="progindig3_topic4"&gt;&lt;/a&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;The Service Model&lt;/span&gt;&lt;/h2&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Programming in Indigo is delightfully straightforward. With all of Indigo's many capabilities, you might expect the API to be enormous—and it's true that there are hundreds of classes and interfaces. Fortunately, you have to be familiar with only a small subset of them for typical application development tasks. What makes this possible is a carefully designed system of classes, declarative attributes, and configuration settings collectively known as the &lt;b&gt;service model&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Most application developers will use the service model; there's no reason not to. Using the service model doesn't box you into a corner: if you occasionally want to do something at a lower level, you simply add some code. This is one of the nicest things about the Indigo API because you don't have to worry about going down a wrong path. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;blockquote class="dtBlock"&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Tip&lt;/b&gt; The service model is your friend. Take advantage of it.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;What Service Programs Look Like&lt;/span&gt;&lt;/h3&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Service programs contain four elements:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Contract definitions&lt;/b&gt; A service must have at least one service contract, and it might contain multiple service contracts, data contracts, or message contracts.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Implementation code&lt;/b&gt; The service contracts in a service need code to implement their service operations.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Hosting code&lt;/b&gt; Some code is needed to create and start the service.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;Endpoint definitions&lt;/b&gt; One or more address–binding–contract endpoints must be declared.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ul&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Listing 3-4 shows a simple service hosted in a C# console program, and Listing 3-5 shows its accompanying configuration file. Take a moment to note the contract definitions, implementation code, hosting code, and endpoint definition.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Listing 3-4. &lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Sample Service Program&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;using System;&lt;br /&gt;using System.ServiceModel;&lt;br /&gt;&lt;br /&gt;namespace Microsoft.Samples.Indigo.Samples&lt;br /&gt;{&lt;br /&gt;    [ServiceContract]&lt;br /&gt;    public interface ISampleContract&lt;br /&gt;    {&lt;br /&gt;        [OperationContract]&lt;br /&gt;        double Add(double n1, double n2);&lt;br /&gt;        [OperationContract]&lt;br /&gt;        double Subtract(double n1, double n2);&lt;br /&gt;        [OperationContract]&lt;br /&gt;        double Multiply(double n1, double n2);&lt;br /&gt;        [OperationContract]&lt;br /&gt;        double Divide(double n1, double n2);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    [ServiceBehavior]&lt;br /&gt;    public class SampleService : ISampleContract&lt;br /&gt;    {&lt;br /&gt;        public double Add(double n1, double n2)&lt;br /&gt;        {&lt;br /&gt;            return n1 + n2;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public double Subtract(double n1, double n2)&lt;br /&gt;        {&lt;br /&gt;            return n1 - n2;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public double Multiply(double n1, double n2)&lt;br /&gt;        {&lt;br /&gt;            return n1 * n2;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public double Divide(double n1, double n2)&lt;br /&gt;        {&lt;br /&gt;            return n1 / n2;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public static void Main()&lt;br /&gt;        {&lt;br /&gt;            using (ServiceHost&amp;lt;SampleService&amp;gt; serviceHost =&lt;br /&gt;               new ServiceHost&amp;lt;SampleService&amp;gt;();&lt;br /&gt;            {&lt;br /&gt;                serviceHost.Open();&lt;br /&gt;                Console.WriteLine("Press ENTER to shut down service.");&lt;br /&gt;                Console.ReadLine();&lt;br /&gt;                serviceHost.Close();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Listing 3-5. &lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Sample Service Configuration File&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;&amp;lt;configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"&amp;gt;&lt;br /&gt;    &amp;lt;system.serviceModel&amp;gt;&lt;br /&gt;        &amp;lt;services&amp;gt;&lt;br /&gt;            &amp;lt;service serviceType="Microsoft.Samples.Indigo.Samples.SampleService"&amp;gt;&lt;br /&gt;                &amp;lt;endpoint&lt;br /&gt;                    address="http://localhost:8000/SampleService/"&lt;br /&gt;                    bindingSectionName="basicProfileBinding"&lt;br /&gt;                    contractType="Microsoft.Samples.Indigo.Samples.ISampleContract" /&amp;gt;&lt;br /&gt;            &amp;lt;/service&amp;gt;&lt;br /&gt;        &amp;lt;/services&amp;gt;&lt;br /&gt;    &amp;lt;/system.serviceModel&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4 class="dtH1" align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Contracts&lt;/span&gt;&lt;/h4&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You define service contracts, data contracts, and message contracts by using declarative attributes. &lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You define service contracts by annotating an interface with &lt;i&gt;[ServiceContract]&lt;/i&gt;. You identify service operations by annotating methods with &lt;i&gt;[OperationContract]&lt;/i&gt;. The following service contract defines four service operations: Add, Subtract, Multiply, and Divide.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;[ServiceContract]&lt;br /&gt;public interface ISampleContract&lt;br /&gt;{&lt;br /&gt;    [OperationContract]&lt;br /&gt;    double Add(double n1, double n2);&lt;br /&gt;    [OperationContract]&lt;br /&gt;    double Subtract(double n1, double n2);&lt;br /&gt;    [OperationContract]&lt;br /&gt;    double Multiply(double n1, double n2);&lt;br /&gt;    [OperationContract]&lt;br /&gt;    double Divide(double n1, double n2);&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;You define data contracts by annotating a class with &lt;i&gt;[DataContract] &lt;/i&gt;and its members with &lt;i&gt;[DataMember]&lt;/i&gt;. The following data contract defines a structure for contact information.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;pre class="code"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;[DataContract]&lt;br /&gt;public class Contact&lt;br /&gt;{&lt;br /&gt;    [DataMember]    public int ContactType;&lt;br /&gt;    [DataMember]    public string LastName;&lt;br /&gt;    [DataMember]    public string FirstName;&lt;br /&gt;    [DataMember]    public string Address;&lt;br /&gt;    [DataMember]    public string City;&lt;br /&gt;    [DataMember]    public string Region;&lt;br /&gt;
