<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>My Tryst with Code</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/alvarod/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/alvarod/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 04:37:10 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>WCF service hosted in IIS - "This collection already contains an address with scheme http" - Why does this happen?</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/wcf-service-hosted-in-iis-this-collection-already-contains-an-address-with-scheme-http-why-does-this-happen</link>
      <pubDate>Sun, 14 Nov 2010 09:55:52 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2010/11/14/wcf-service-hosted-in-iis-this-collection-already-contains-an-address-with-scheme-http-why-does-this-happen/</guid>
      <description><![CDATA[I came across this error when I tried hosting a WCF endpoint from a website in IIS. This can be...]]></description>
      <content:encoded><![CDATA[I came across this error when I tried hosting a WCF endpoint from a website in IIS. This can be resolved by adding the following section in the web.config file

<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>&lt;</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">serviceHostingEnvironment</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"> </span><span style="FONT-FAMILY: Consolas; COLOR: red; FONT-SIZE: 9.5pt">aspNetCompatibilityEnabled</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">=</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">"<span style="COLOR: blue">true</span>"<span style="COLOR: blue">&gt;</span></p></span>

<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&lt;</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">baseAddressPrefixFilters</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&gt;</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"></p></span>

<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&lt;</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">add</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"> </span><span style="FONT-FAMILY: Consolas; COLOR: red; FONT-SIZE: 9.5pt">prefix</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">=</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="COLOR: blue"><a href="https://www.myhost.com/">https://www.myhost.com/</a></span><span style="COLOR: blue"> /&gt;</span></span></p>

<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&lt;/</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">baseAddressPrefixFilters</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&gt;</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"></p></span>

<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>&lt;/</span><span style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">serviceHostingEnvironment</span><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&gt;</p></span>

&nbsp;

Why does this happen?

When you host a website using a shared hosting provider, it is possible that there are multiple IIS bindings for the site. This results in multiple base addresses for each scheme which WCF doesn't support. Hence, we use the baseAddressPrefixFilters to filter out the IIS bindings and only use the relevant one for the WCF endpoint.

To get a better and complete picture read through the Remarks section over here: <a href="https://msdn.microsoft.com/en-us/library/bb924481.aspx">https://msdn.microsoft.com/en-us/library/bb924481.aspx</a>

<p>Alvaro </p>]]></content:encoded>
    </item>
    <item>
      <title>Unhandled Error in Silverlight Application Code: 2103    Category: InitializeError       Message: Invalid or malformed application: Check manifest</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/unhandled-error-in-silverlight-application-code-2103-category-initializeerror-message-invalid-or-malformed-application-check-manifest</link>
      <pubDate>Sun, 14 Nov 2010 06:21:00 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2010/11/14/unhandled-error-in-silverlight-application-code-2103-category-initializeerror-message-invalid-or-malformed-application-check-manifest/</guid>
      <description><![CDATA[This is one weird error I encountered while creating a simple Silverlight...]]></description>
      <content:encoded><![CDATA[<p>This is one weird error I encountered while creating a simple Silverlight application.&nbsp;</p>
<p>Scenario: Tested my application and post that I decided (for some reasons not relevant here) to change the namespace of the classes in my silverlight project. As part of this, I changed the namespace of the App class in the App.xaml.cs file.</p>
<p>As soon as i ran the application again, it started giving me this error.</p>
<p>Solution: It turns out that when we change the namespace of the App class, the "Startup Object" in the project properties doesn't get updated causing this error. When we update this in the project properties it starts working fine again.</p>
<p>Regards,</p>
<p>Alvaro </p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Pef for fun - an interesting tool to promote TDD</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/pef-for-fun-an-interesting-tool-to-promote-tdd</link>
      <pubDate>Wed, 18 Aug 2010 08:54:22 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2010/08/18/pef-for-fun-an-interesting-tool-to-promote-tdd/</guid>
      <description><![CDATA[Hi Folks,
the PEX team has released on online version of their unit testing tool at...]]></description>
      <content:encoded><![CDATA[<p>Hi Folks,</p>
<p>the PEX team has released on online version of their unit testing tool at <a href="https://www.pexforfun.com/">https://www.pexforfun.com/</a> </p>
<p>I found this to be a real fun way to explore and understand how Test Driven Development is all about.</p>
<p>having said that, i'd like to add that PEX is much more than the above site. for more details on PEX, you can go to their main site @ <a href="https://research.microsoft.com/en-us/projects/pex/">https://research.microsoft.com/en-us/projects/pex/</a></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><a name="_MailAutoSig"></a><span style="font-family: 'Lucida Handwriting'; color: green; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes;">Regards,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="mso-bookmark: _MailAutoSig;"><span style="font-family: 'Lucida Handwriting'; color: green; font-size: 16pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes;">AlD</span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>What happens when a constuctor is called</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/what-happens-when-a-constuctor-is-called</link>
      <pubDate>Fri, 06 Aug 2010 00:13:00 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2010/08/06/what-happens-when-a-constuctor-is-called/</guid>
      <description><![CDATA[Consider the following...]]></description>
      <content:encoded><![CDATA[<p class="MsoNormal"><span style="font-size: small;"><span style="font-family: Calibri;">Consider the following class<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'">public</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'">&nbsp;<span style="COLOR: blue">class</span>&nbsp;<span style="COLOR: #2b91af">MyClass</span><br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="COLOR: blue">public</span>&nbsp;<span style="COLOR: blue">int</span>&nbsp;myField&nbsp;=&nbsp;4;<br /><span style="mso-spacerun: yes">&nbsp;</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="COLOR: blue">public</span>&nbsp;MyClass()<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="COLOR: blue">this</span>.myField&nbsp;=&nbsp;5;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<o:p></o:p></span></p>
<p class="MsoNoSpacing"><o:p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></o:p><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">when we compile this class, we get an assembly with IL in it. The parameterless constructor gets converted into a method with the name .ctor <o:p></o:p></span></p>
<pre><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">Now, if we see the IL that gets generated for this .ctor method, we might expect it to have IL opcodes to assign the value 5 to the myField field of the class. <o:p></o:p></span></pre>
<pre><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">However, we can see that there is a lot more in there.<o:p></o:p></span></pre>
<pre><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">First of all, we see IL commands to assign the value 4 to myField, then the .ctor method of System.Object gets called. Finally, we see the code within the MyClass&rsquo;s constructor.<o:p></o:p></span></pre>
<pre><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"><o:p></o:p></span></pre>
<pre><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">When we write code to instantiate this class using the new operator (i.e.</span><span style="font-size: x-small;"><span style="font-family: Courier New;"> </span><span style="FONT-FAMILY: Consolas; COLOR: #2b91af">MyClass</span><span style="FONT-FAMILY: Consolas">&nbsp;myObject&nbsp;=&nbsp;<span style="COLOR: blue">new</span>&nbsp;<span style="COLOR: #2b91af">MyClass</span>();</span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">) the following things happen in the given order: -<o:p></o:p></span></pre>
<pre style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 0.5in; mso-list: l0 level1 lfo1"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore">1.<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">Execution of the initializers of all the class&rsquo;s fields<o:p></o:p></span></pre>
<pre style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 0.5in; mso-list: l0 level1 lfo1"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore">2.<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">Execution of the class&rsquo;s base class constructor<o:p></o:p></span></pre>
<pre style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 0.5in; mso-list: l0 level1 lfo1"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore">3.<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">Execution of the code within this class constructor</span></pre>
<pre><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">Let us create another class MyDerivedClass and derive it from MyClass as below.</span><span style="FONT-FAMILY: Consolas; COLOR: blue"><o:p><span style="font-size: x-small;">&nbsp;</span></o:p></span></pre>
<pre><span style="FONT-FAMILY: Consolas; COLOR: blue"><o:p><span style="font-size: x-small;"></span></o:p></span><span style="FONT-FAMILY: Consolas"><span style="font-size: x-small;"><o:p><span style="color: blue;">public</span>&nbsp;<span style="color: blue;">class</span>&nbsp;<span style="color: #2b91af;">MyDerivedClass</span>&nbsp;:&nbsp;<span style="color: #2b91af;">MyClass</span><br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">public</span>&nbsp;<span style="color: blue;">int</span>&nbsp;myDerivedProperty&nbsp;=&nbsp;6;<br /> <br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">public</span>&nbsp;MyDerivedClass()<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue;">this</span>.myDerivedProperty&nbsp;=&nbsp;7;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</o:p></span></span></pre>
<pre><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">When we instantiate MyDerivedClass, by the same flow as earlier, the following things happen in order<o:p></o:p></span></pre>
<pre style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 0.5in; mso-list: l1 level1 lfo2"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore">1.<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">myDerivedProperty gets initialized to 6<o:p></o:p></span></pre>
<pre style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 0.5in; mso-list: l1 level1 lfo2"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore">2.<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">the constructor of MyClass gets called<o:p></o:p></span></pre>
<pre style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l1 level2 lfo2"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore">a.<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">MyClass.myField gets initialized to 4<o:p></o:p></span></pre>
<pre style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l1 level2 lfo2"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore">b.<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">The constructor of System.Object gets called<o:p></o:p></span></pre>
<pre style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 1in; mso-list: l1 level2 lfo2"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore">c.<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">MyClass.myField is assigned the value 5 due to the code in MyClass&rsquo;s constructor<o:p></o:p></span></pre>
<pre style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 0.5in; mso-list: l1 level1 lfo2"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin"><span style="mso-list: Ignore">3.<span style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi">myDerivedProperty is assigned the value 7 due to the code in MyDerivedClass&rsquo;s constructor</span></pre>
<pre sizset="0" sizcache="9" style="TEXT-INDENT: -0.25in; MARGIN-LEFT: 0.5in; mso-list: l1 level1 lfo2"><span style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-bidi"></span><table cellpadding="5" cellspacing="5" border="0" style="background-color: #f5c05b; width: 600px;"><tbody><tr><td><p><strong>Addendum</strong></p><p>Thought, I'd the IL that gets generated for the constructor.</p><p>Looking at the C# code written in the constructor, we might expect to see code somethign like below</p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;">.method public hidebysig specialname rtspecialname <o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>instance void<span style="mso-spacerun: yes;">&nbsp; </span>.ctor() cil managed<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;">{<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>// Code size<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>17 (0x11)<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>.maxstack<span style="mso-spacerun: yes;">&nbsp; </span>8</span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0000:<span style="mso-spacerun: yes;">&nbsp; </span>ldarg.0<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0001:<span style="mso-spacerun: yes;">&nbsp; </span>ldc.i4.7<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0002:<span style="mso-spacerun: yes;">&nbsp; </span>stfld<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>int32 ConsoleApplication5.MyDerivedClass::myDerivedProperty<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0007:<span style="mso-spacerun: yes;">&nbsp; </span>nop<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0008:<span style="mso-spacerun: yes;">&nbsp; </span>ret<o:p></o:p></span></p><p><span style="line-height: 115%; font-family: Fixedsys; font-size: 10.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Fixedsys; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">} // end of method MyDerivedClass::.ctor</span>&nbsp;</p><p>&nbsp;However, what we see is something like below</p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;">.method public hidebysig specialname rtspecialname <o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>instance void<span style="mso-spacerun: yes;">&nbsp; </span>.ctor() cil managed<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;">{<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>// Code size<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>24 (0x18)<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>.maxstack<span style="mso-spacerun: yes;">&nbsp; </span>8<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0000:<span style="mso-spacerun: yes;">&nbsp; </span>ldarg.0<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0001:<span style="mso-spacerun: yes;">&nbsp; </span>ldc.i4.6<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0002:<span style="mso-spacerun: yes;">&nbsp; </span>stfld<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>int32 ConsoleApplication5.MyDerivedClass::myDerivedProperty<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0007:<span style="mso-spacerun: yes;">&nbsp; </span>ldarg.0<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0008:<span style="mso-spacerun: yes;">&nbsp; </span>call<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>instance void ConsoleApplication5.MyClass::.ctor()<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_000d:<span style="mso-spacerun: yes;">&nbsp; </span>nop<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_000e:<span style="mso-spacerun: yes;">&nbsp; </span>nop<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_000f:<span style="mso-spacerun: yes;">&nbsp; </span>ldarg.0<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0010:<span style="mso-spacerun: yes;">&nbsp; </span>ldc.i4.7<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0011:<span style="mso-spacerun: yes;">&nbsp; </span>stfld<span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>int32 ConsoleApplication5.MyDerivedClass::myDerivedProperty<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0016:<span style="mso-spacerun: yes;">&nbsp; </span>nop<o:p></o:p></span></p><p class="MsoNormal"><span style="font-family: Fixedsys; font-size: 10.5pt; mso-bidi-font-family: Fixedsys;"><span style="mso-spacerun: yes;">&nbsp; </span>IL_0017:<span style="mso-spacerun: yes;">&nbsp; </span>ret<o:p></o:p></span></p><p><span style="line-height: 115%; font-family: Fixedsys; font-size: 10.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Fixedsys; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA;">} // end of method MyDerivedClass::.ctor</span></p><p>i.e. first the variable initializer gets executed, then the base constructor gets called and finally we have the IL corresponding to the C# code written in the class constructor</p></td></tr></tbody></table>&nbsp;</pre>]]></content:encoded>
    </item>
    <item>
      <title>what using the 'using' block in c# does to your code</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/what-using-the-using-block-in-c-does-to-your-code</link>
      <pubDate>Wed, 14 Apr 2010 04:01:00 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2010/04/14/what-using-the-using-block-in-c-does-to-your-code/</guid>
      <description><![CDATA[Let us take a simple console application which has the below code written in it
&nbsp;&nbsp;&nbsp;...]]></description>
      <content:encoded><![CDATA[<p>Let us take a simple console application which has the below code written in it</p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">class</span> <span style="COLOR: #2b91af">Program</span><o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">static</span> <span style="COLOR: blue">void</span> Main(<span style="COLOR: blue">string</span>[] args)<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">using</span> (<span style="COLOR: #2b91af">SqlConnection</span> connection = <span style="COLOR: blue">new</span> <span style="COLOR: #2b91af">SqlConnection</span>())<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>connection.Open();<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>connection.Close();<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p>
<p>the IL that gets generated for the above program looks something like below... </p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>[<span style="COLOR: maroon">0</span>] <span style="COLOR: #1000a0">class</span> [<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Data:4.0.0.0:b77a5c561934e089" title="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><span style="COLOR: blue">System.Data</span></a>]<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Data:4.0.0.0:b77a5c561934e089/System.Data.SqlClient.SqlConnection" title="[System.Data]System.Data.SqlClient.SqlConnection"><span style="COLOR: blue">System.Data.SqlClient.SqlConnection</span></a> <b>connection</b>)<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0000: ldnull <o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0001: stloc.0 <o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0002: ldloc.0 <o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0003: callvirt <span style="COLOR: #1000a0">instance</span> <a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Void" title="void"><span style="COLOR: blue">void</span></a> [<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Data:4.0.0.0:b77a5c561934e089" title="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><span style="COLOR: blue">System.Data</span></a>]<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Data:4.0.0.0:b77a5c561934e089/System.Data.Common.DbConnection" title="[System.Data]System.Data.Common.DbConnection"><span style="COLOR: blue">System.Data.Common.DbConnection</span></a>::<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Data:4.0.0.0:b77a5c561934e089/System.Data.Common.DbConnection/Open()" title="Open"><span style="COLOR: blue">Open</span></a>()<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0008: ldloc.0 <o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0009: callvirt <span style="COLOR: #1000a0">instance</span> <a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Void" title="void"><span style="COLOR: blue">void</span></a> [<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Data:4.0.0.0:b77a5c561934e089" title="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><span style="COLOR: blue">System.Data</span></a>]<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Data:4.0.0.0:b77a5c561934e089/System.Data.Common.DbConnection" title="[System.Data]System.Data.Common.DbConnection"><span style="COLOR: blue">System.Data.Common.DbConnection</span></a>::<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Data:4.0.0.0:b77a5c561934e089/System.Data.Common.DbConnection/Close()" title="Close"><span style="COLOR: blue">Close</span></a>()<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_000e: leave.s L_001a<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0010: ldloc.0 <o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0011: brfalse.s L_0019<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0013: ldloc.0 <o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0014: callvirt <span style="COLOR: #1000a0">instance</span> <a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.Void" title="void"><span style="COLOR: blue">void</span></a> [<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089" title="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><span style="COLOR: blue">mscorlib</span></a>]<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.IDisposable" title="[mscorlib]System.IDisposable"><span style="COLOR: blue">System.IDisposable</span></a>::<a href="https://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:4.0.0.0:b77a5c561934e089/System.IDisposable/Dispose()" title="Dispose"><span style="COLOR: blue">Dispose</span></a>()<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_0019: endfinally <o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; 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"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>L_001a: ret <o:p></o:p></span></p>
<p><span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #1000a0">.try</span> L_0002 <span style="COLOR: #1000a0">to</span> L_0010 <span style="COLOR: #1000a0">finally</span> <span style="COLOR: #1000a0">handler</span> L_0010 <span style="COLOR: #1000a0">to</span> L_001a</span>&nbsp;</p>
<p>On analyzing this IL what we realize is that this code is nothing but syntactic sugar for the try-finally block shown below</p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; COLOR: #2b91af; FONT-SIZE: 9.5pt">SqlConnection</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> connection = <span style="COLOR: blue">new</span> <span style="COLOR: #2b91af">SqlConnection</span>();<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">try</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">{<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>connection.Open();<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>connection.Close();<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">}<o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">finally</span><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">{</span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><o:p><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; <span style="color: #0000ff;">if</span>(</span>connection != <span style="color: #0000ff;">null</span>)</span></o:p></span></p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;<span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></span></span>connection.Dispose();<o:p></o:p></span></p>
<p><span style="LINE-HEIGHT: 115%; FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">}</span>&nbsp;</p>
<p>Overall a pretty neat feature to have... </p>
<p>Till my next post,</p>
<p class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt"><a name="_MailAutoSig" title="_MailAutoSig"></a><span style="FONT-FAMILY: 'Lucida Handwriting'; COLOR: green; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes">Regards,<o:p></o:p></span></p>
<p><span style="mso-bookmark: _MailAutoSig"><span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Lucida Handwriting'; COLOR: green; FONT-SIZE: 16pt; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes">AlD</span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>How To: Enable multiple netTcp port sharing for WCF end-points</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/how-to-enable-multiple-nettcp-port-sharing-for-wcf-end-points</link>
      <pubDate>Tue, 09 Mar 2010 22:55:00 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2010/03/09/how-to-enable-multiple-nettcp-port-sharing-for-wcf-end-points/</guid>
      <description><![CDATA[Getting straight to the point, the checklist for this can be found here. 3 basic tasks need to be...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3 face=Calibri>Getting straight to the point, the checklist for this can be found </FONT><A href="https://technet.microsoft.com/en-us/library/cc753154.aspx"><FONT size=3 face=Calibri>here</FONT></A><FONT size=3><FONT face=Calibri>. 3 basic tasks need to be done: -<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraph><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>1.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Enable port sharing by either adding an attribute in your code like below<o:p></o:p></FONT></FONT></P>
<TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; MARGIN: auto auto auto 0.5in; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoTableGrid border=1 cellSpacing=0 cellPadding=0 class="MsoTableGrid">
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 6.65in; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt" vAlign=top width=638>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #2b91af; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: #2b91af; FONT-SIZE: 9.5pt">NetTcpBinding</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"> binding = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">NetTcpBinding</SPAN>(<SPAN style="COLOR: #a31515">"netTcpBinding"</SPAN>);<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">binding.PortSharingEnabled = <SPAN style="COLOR: blue">true</SPAN>;<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">serviceHost = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">ServiceHost</SPAN>(<SPAN style="COLOR: blue">typeof</SPAN>(<SPAN style="COLOR: #2b91af">MsiFacade35Service</SPAN>));<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">serviceHost.AddServiceEndpoint(<SPAN style="COLOR: blue">typeof</SPAN>(<SPAN style="COLOR: #2b91af">IMsiFacade35Service</SPAN>), binding, <SPAN style="COLOR: #a31515">"net.tcp://MyServer/MyServiceEndpoint"</SPAN>);<o:p></o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P></TD></TR></TBODY></TABLE>
<P style="MARGIN: 0in 0in 10pt 0.5in" class=MsoListParagraph><FONT size=3><FONT face=Calibri>Or by setting in the app.config like below=<o:p></o:p></FONT></FONT></P>
<TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; MARGIN: auto auto auto 0.5in; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoTableGrid border=1 cellSpacing=0 cellPadding=0 class="MsoTableGrid">
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
<TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: windowtext 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 6.65in; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid windowtext .5pt" vAlign=top width=638>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">&lt;</SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: #a31515; FONT-SIZE: 9.5pt">binding</SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"> </SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: red; FONT-SIZE: 9.5pt">name</SPAN><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt">=</SPAN><SPAN style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt">"<SPAN style="COLOR: blue">bindingNetTcp</SPAN>"<SPAN style="COLOR: blue"> </SPAN><SPAN style="COLOR: red">portSharingEnabled</SPAN><SPAN style="COLOR: blue">=</SPAN>"<SPAN style="COLOR: blue">true</SPAN>"<SPAN style="COLOR: blue"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>/&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: Consolas; COLOR: blue; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P></TD></TR></TBODY></TABLE>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoListParagraphCxSpFirst><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1" class=MsoListParagraphCxSpMiddle><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>2.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Enable and configure the Net Tcp Port Sharing Service – which involves the following<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l1 level2 lfo1" class=MsoListParagraphCxSpMiddle><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>a.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Enable the Application Server role with the TCP Port Sharing selected<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l1 level2 lfo1" class=MsoListParagraphCxSpMiddle><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>b.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3 face=Calibri>Update the app.config for SmSvcHost.exe with the below config - </FONT><A href="https://msdn.microsoft.com/en-us/library/aa702669(VS.100).aspx"><FONT size=3 face=Calibri>https://msdn.microsoft.com/en-us/library/aa702669(VS.100).aspx</FONT></A><FONT size=3><FONT face=Calibri> **<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 1in; mso-add-space: auto; mso-list: l1 level2 lfo1" class=MsoListParagraphCxSpLast><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>c.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>Restart the “Net.Tcp Port Sharing Service” from services.msc<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>** One GOTCHA: <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>Though the link says to go to “C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation”, for .NET 4, you would need to update the app.config in the below locations based on the bitness of the box and the .NET Build.<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpFirst><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>a.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>C:\Windows\Microsoft.NET\Framework\v4.0.30128 ** for .NET 4 RC – x86 CPU<o:p></o:p></FONT></FONT></P>
<P style="TEXT-INDENT: -0.25in; MARGIN: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo2" class=MsoListParagraphCxSpLast><SPAN style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"><SPAN style="mso-list: Ignore"><FONT size=3 face=Calibri>b.</FONT><SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><FONT size=3><FONT face=Calibri>C:\Windows\Microsoft.NET\Framework64\v4.0.30128 ** for .NET 4 RC – x64 CPU<o:p></o:p></FONT></FONT></P>
<P style="MARGIN: 0in 0in 10pt" class=MsoNormal><FONT size=3><FONT face=Calibri>You can confirm the correct location to update the app.config by going to services.msc and checking the executable path in the properties of the Net.Tcp Port Sharing Service.</FONT></FONT></P><FONT size=3><FONT face=Calibri><o:p>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal minmax_bound="true"><A name=_MailAutoSig minmax_bound="true"></A><SPAN style="FONT-FAMILY: 'Lucida Handwriting'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast" minmax_bound="true">Regards,<o:p minmax_bound="true"></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal minmax_bound="true"><SPAN style="mso-bookmark: _MailAutoSig" minmax_bound="true"><SPAN style="FONT-FAMILY: 'Lucida Handwriting'; COLOR: green; FONT-SIZE: 16pt; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast" minmax_bound="true">AlD</SPAN></SPAN></P></o:p></FONT></FONT>]]></content:encoded>
    </item>
    <item>
      <title>Nice to have C# 5.0 LinQ feature</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/nice-to-have-c-5-0-linq-feature</link>
      <pubDate>Mon, 15 Feb 2010 23:46:00 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2010/02/15/nice-to-have-c-5-0-linq-feature/</guid>
      <description><![CDATA[currently LinQ only supports projections, instead if we could perform an action for each row inside...]]></description>
      <content:encoded><![CDATA[currently LinQ only supports projections, instead if we could perform an action for each row inside the linq query itself it would be great.<p>&nbsp;I had in mind something like the below query in mind. Hopefully C# team would consider this :-)</p><p mce_keep="true"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="COLOR: #2b91af">Collection</span>&lt;<span style="COLOR: #2b91af">DataEndpoint</span>&gt; myObjects = <span style="COLOR: blue">new</span> <span style="COLOR: #2b91af">Collection</span>&lt;<span style="COLOR: #2b91af">DataEndpoint</span>&gt;();<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><p></p></span></p><p style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><p></p></span></p><p style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="COLOR: blue">var</span> dataExtensions = <span style="COLOR: blue">from</span> c <span style="COLOR: blue">in</span> dataContext.ETDataExtensions<p></p></span></p><p style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: blue">join</span> d <span style="COLOR: blue">in</span> dataContext.RequestTypeDatas <span style="COLOR: blue">on</span> c.RequestTypeID <span style="COLOR: blue">equals</span> d.RequestTypeID<p></p></span></p><p style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: blue">where</span> d.RequestType == requestType.ToString()<p></p></span></p><p style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: Consolas; FONT-SIZE: 9.5pt"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="BACKGROUND: yellow; COLOR: blue; mso-highlight: yellow">selectOrDo</span><span style="BACKGROUND: yellow; mso-highlight: yellow"> myObjects.Add(c);</span><p></p></span></p><p mce_keep="true">Till my next post, adeus.</p><p style="MARGIN: 0in 0in 0pt" class="MsoNormal"><a name="_MailAutoSig"></a><span style="FONT-FAMILY: 'Lucida Handwriting'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast">Regards,<p></p></span></p><p style="MARGIN: 0in 0in 0pt" class="MsoNormal"><span style="mso-bookmark: _MailAutoSig"><span style="FONT-FAMILY: 'Lucida Handwriting'; COLOR: green; FONT-SIZE: 16pt; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast">AlD</span></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Want a treat? Get others to send you an invite  :P</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/want-a-treat-get-others-to-send-you-an-invite-p</link>
      <pubDate>Mon, 28 Dec 2009 11:28:00 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2009/12/28/want-a-treat-get-others-to-send-you-an-invite-p/</guid>
      <description><![CDATA[Here's an example of my "idle mind at work"... writing code just for the heck of...]]></description>
      <content:encoded><![CDATA[Here's an example of my "idle mind at work"... writing code just for the heck of it...<p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SendKeys</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.SendWait(<span style="COLOR: #a31515">"^({ESC})"</span>);<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">Thread</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.Sleep(500);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SendKeys</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.SendWait(<span style="COLOR: #a31515">"run"</span>);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">Thread</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.Sleep(1000);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SendKeys</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.SendWait(<span style="COLOR: #a31515">"{ENTER}"</span>);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">Thread</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.Sleep(500);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><p>&nbsp;</p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">String</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> currentRecepients = <span style="COLOR: #a31515">"&lt;your To List&gt;"</span>;<span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">//Enter all emails separated by semi colons</span></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><p>&nbsp;</p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SendKeys</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.SendWait(<span style="COLOR: #a31515">"mailto:"</span> + currentRecepients + <span style="COLOR: #a31515">";"<font color="#000000">;</font><span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">//</span></span>+ <span style="COLOR: #2b91af">WindowsIdentity</span>.GetCurrent().Name.Split(<span style="COLOR: #a31515">'\\'</span>)[1]);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">Thread</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.Sleep(500);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SendKeys</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.SendWait(<span style="COLOR: #a31515">"{ENTER}"</span>);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">Thread</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.Sleep(500);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SendKeys</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.SendWait(<span style="COLOR: #a31515">"treat from me at barista... today 4:30pm"</span>);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SendKeys</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.SendWait(<span style="COLOR: #a31515">"{TAB}"</span>);<p></p></span></p><p style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class="MsoNormal"><span style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SendKeys</span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.SendWait(<span style="COLOR: #a31515">"no particular reason... just for the heck of it"</span>);<p></p></span></p><p style="MARGIN: 0in 0in 10pt" class="MsoNormal"><span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt; mso-no-proof: yes">SendKeys</span><span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">.SendWait(<span style="COLOR: #a31515">"%(s)"</span>);</span><p></p></p><p mce_keep="true">What it does is pretty simple actually. It opens outlook and sends a mail from the guy running this code to the intended recepients.</p><p mce_keep="true">Now how can you get your target user to run this code? Well, thats upto you to figure out.</p><p style="MARGIN: 0in 0in 0pt" class="MsoNormal"><a name="_MailAutoSig"></a><span style="FONT-FAMILY: 'Lucida Handwriting'; COLOR: green; FONT-SIZE: 10pt; mso-no-proof: yes; mso-fareast-font-family: 'Times New Roman'; mso-fareast-theme-font: minor-fareast">Complements of the season,</span></p><p style="MARGIN: 0in 0in 0pt" class="MsoNormal"><img style="WIDTH: 204px; HEIGHT: 58px" title="Alvaro Dias" alt="Alvaro Dias" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/94/18/48/alvaro_name.png" original-url="https://blogs.msdn.com/photos/alvarorahul/images/9941848/original.aspx" width="204" height="58" mce_src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/09/94/18/48/alvaro_name.png" original-url="https://blogs.msdn.com/photos/alvarorahul/images/9941848/original.aspx"></p>]]></content:encoded>
    </item>
    <item>
      <title>Once I was a College Student</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/once-i-was-a-college-student</link>
      <pubDate>Mon, 28 Dec 2009 11:23:00 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2009/12/28/once-i-was-a-college-student/</guid>
      <description><![CDATA[&lt;re-published from my old blog&gt;

So there I was, sitting at my desk staring at the computer...]]></description>
      <content:encoded><![CDATA[&lt;re-published from my old blog&gt;

<span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes"><span style="FONT-FAMILY: verdana, geneva">So there I was, sitting at my desk staring at the computer screen working on VS 2010 and exploring a bit of F#. I just sat back and started reflecting on my college days and the interviewing season in the 7th semester. All of us, revising all our technical knowledge, solving puzzles and complex analytical problems.<br>As I think about it now, I think that those problems (especially the programming ones) were pretty easy ones, but in that period, preparing for your first tryst with the world outside, its a huge thing. So, feeling a little nostalgic, I thought I&rsquo;ll rewrite some of those programs in C# this time.<br></span></span></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes"><br><span style="FONT-FAMILY: verdana, geneva">1.&nbsp; How to swap two numbers without using a third variable.</span><br></span></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">public</span> <span style="COLOR: blue">class</span> <span style="COLOR: #2b91af">SwapperClass<br></span></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">public</span> <span style="COLOR: blue">static</span> <span style="COLOR: blue">void</span> Main()<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">int</span> number1 = 10;<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">int</span> number2 = 20;<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #2b91af">Console</span>.WriteLine(<span style="COLOR: #a31515">"a = {0}, b={1}"</span>, number1, number2);<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Swap(<span style="COLOR: blue">ref</span> number1, <span style="COLOR: blue">ref</span> number2);<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #2b91af">Console</span>.WriteLine(<span style="COLOR: #a31515">"a = {0}, b={1}"</span>, number1, number2);<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #2b91af">Console</span>.ReadLine();<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">&nbsp;<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">public</span> <span style="COLOR: blue">static</span> <span style="COLOR: blue">void</span> Swap(<span style="COLOR: blue">ref</span> <span style="COLOR: blue">int</span> a, <span style="COLOR: blue">ref</span> <span style="COLOR: blue">int</span> b)<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>a = a + b;<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>b = a - b;<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>a = a - b;<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<br></span><span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;</span><span style="mso-spacerun: yes">&nbsp;</span>}</span>

<span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes"><span style="FONT-FAMILY: verdana, geneva">2.&nbsp; How to find out whether a number is a power of 2 or not in O(1) or without using any loops<br></span>&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">public</span> <span style="COLOR: blue">class</span> <span style="COLOR: #2b91af">PowerOfTwo<br></span></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">public</span> <span style="COLOR: blue">static</span> <span style="COLOR: blue">void</span> Main()<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #2b91af">Console</span>.WriteLine(IsPowerOfTwo(4));<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #2b91af">Console</span>.ReadKey();<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">&nbsp;<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">public</span> <span style="COLOR: blue">static</span> <span style="COLOR: blue">bool</span> IsPowerOfTwo(<span style="COLOR: blue">int</span> a)<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">return</span> (a != 0 &amp;&amp;&nbsp;(a &amp; (a - 1)) == 0);<br></span><span style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<br></span><span style="LINE-HEIGHT: 115%; FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>}</span>

<span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="FONT-FAMILY: verdana, geneva">Till my next post,</span></span>

<p><span style="LINE-HEIGHT: 115%; FONT-SIZE: 10pt; mso-no-proof: yes"><span style="FONT-FAMILY: verdana, geneva"></span></span></p><div><font color="#00b050" face="Lucida Handwriting">Regards,</font></div><div>&nbsp;</div><div><font color="#00b050" size="6" face="Lucida Handwriting"><em>AlD</em></font></div>]]></content:encoded>
    </item>
    <item>
      <title>Creating your own Visual Studio code snippets</title>
      <link>https://docs.microsoft.com/archive/blogs/alvarod/creating-your-own-visual-studio-code-snippets</link>
      <pubDate>Mon, 28 Dec 2009 11:13:00 GMT</pubDate>
      <dc:creator><![CDATA[Alvaro Dias]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/alvarod/2009/12/28/creating-your-own-visual-studio-code-snippets/</guid>
      <description><![CDATA[&lt;re-published from my old blog&gt;&nbsp;
Some time back I got thinking... everytime I start...]]></description>
      <content:encoded><![CDATA[<P><SPAN style="FONT-SIZE: small">&lt;re-published from my old blog&gt;&nbsp;</SPAN></P>
<P><SPAN style="FONT-SIZE: small">Some time back I got thinking... everytime I start reading mails in the C# discussion alias at my company or Eric Lippert's explanations of why the supposedly peculiar behaviour is in fact logical... the first thing I do is open up my very extensively used "ExperimentalConsoleApplication" solution in&nbsp;Visual Studio, comment out the existing main function in the console app project for future reference and start writing a new one... and it is kind of a pain to do this.. so I thought that it's time to get it automated.. so I wrote a snippet to do that for me.<BR><BR>Below is the code for that: -</SPAN></P>
<P mce_keep="true">&nbsp;</P>
<P>
<TABLE style="WIDTH: 492px; HEIGHT: 471px" border=1>
<TBODY>
<TR>
<TD><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">
<P>&lt;?</SPAN></SPAN></SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">xml</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"> </SPAN></SPAN><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small"><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small">version</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">=</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">1.0</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"> </SPAN></SPAN><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small"><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small">encoding</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">=</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">utf-8</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"> ?&gt;<BR>&lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">CodeSnippets</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"> </SPAN></SPAN><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small"><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small">xmlns</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">=</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">CodeSnippet</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"> </SPAN></SPAN><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small"><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small">Format</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">=</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">1.0.0</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Header</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Title</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">mainfn</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Title</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Shortcut</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">mainfn</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Shortcut</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Description</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">Code snippet for 'Main' function</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Description</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Author</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">Alvaro Rahul Dias</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Author</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">SnippetTypes</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">SnippetType</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">Expansion</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">SnippetType</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">SnippetType</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">SurroundsWith</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">SnippetType</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">SnippetTypes</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Header</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Snippet</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Declarations</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Literal</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">ID</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">expression</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">ID</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">ToolTip</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">Code in main method</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">ToolTip</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Default</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">Console.WriteLine("Hello World!");</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Default</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Literal</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Declarations</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Code</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"> </SPAN></SPAN><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small"><SPAN style="COLOR: #ff0000; FONT-SIZE: x-small">Language</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">=</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">csharp</SPAN></SPAN><SPAN style="FONT-SIZE: x-small">"</SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;&lt;![CDATA[</SPAN></SPAN><SPAN style="COLOR: #808080; FONT-SIZE: x-small"><SPAN style="COLOR: #808080; FONT-SIZE: x-small"> public class MyClass<BR><SPAN style="COLOR: #0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<BR><SPAN style="COLOR: #0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>public static void Main()<BR><SPAN style="COLOR: #0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<BR><SPAN style="COLOR: #0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$expression$<BR><SPAN style="COLOR: #0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>$selected$ $end$<BR><SPAN style="COLOR: #0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<BR><SPAN style="COLOR: #0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">]]&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Code</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">Snippet</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">CodeSnippet</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;<BR>&lt;/</SPAN></SPAN><SPAN style="COLOR: #a31515; FONT-SIZE: x-small"><SPAN style="COLOR: #a31515; FONT-SIZE: x-small">CodeSnippets</SPAN></SPAN><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small"><SPAN style="COLOR: #0000ff; FONT-SIZE: x-small">&gt;</SPAN></SPAN></P></TD></TR></TBODY></TABLE></P>
<P mce_keep="true">&nbsp;</P>
<P><BR><SPAN style="FONT-SIZE: small">Most of the fields above are self explanatory. I'll explain a few important ones.<BR>The <SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #a31515"><SPAN style="COLOR: #a31515">Shortcut</SPAN></SPAN><SPAN style="COLOR: #0000ff"><SPAN style="COLOR: #0000ff">&gt; </SPAN></SPAN>tag specifies what you need to type in VS to use this snippet.<BR><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #a31515"><SPAN style="COLOR: #a31515">SnippetTypes</SPAN></SPAN><SPAN style="COLOR: #0000ff"><SPAN style="COLOR: #0000ff">&gt;</SPAN></SPAN> - where you can use this snippet, Expansion, Surround With or both.<BR><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #a31515"><SPAN style="COLOR: #a31515">Code</SPAN></SPAN><SPAN style="COLOR: #0000ff"><SPAN style="COLOR: #0000ff"> </SPAN></SPAN><SPAN style="COLOR: #ff0000"><SPAN style="COLOR: #ff0000">Language</SPAN></SPAN><SPAN style="COLOR: #0000ff"><SPAN style="COLOR: #0000ff">=</SPAN></SPAN>"<SPAN style="COLOR: #0000ff"><SPAN style="COLOR: #0000ff">csharp</SPAN></SPAN>"<SPAN style="COLOR: #0000ff"><SPAN style="COLOR: #0000ff">&gt; </SPAN></SPAN>- the actual code to be inserted<BR><BR>Interesting thing to note is that all the variable items are marked with $ signs. The&nbsp;<SPAN style="COLOR: #808080">$selected$</SPAN> attribute signifies where the selected code should go in case you use this code as a sorround with snippet.<BR>The&nbsp;<SPAN style="COLOR: #808080">$end$</SPAN> attribute signifies where the cursor should go once you're finished with the snippet.<BR><BR>Hope the above helps in your coding adventures.</SPAN><BR><BR><SPAN style="FONT-SIZE: medium"><SPAN style="FONT-FAMILY: Lucida Handwriting; COLOR: #00b050">&nbsp;</P>
<DIV><FONT color=#00b050 face="Lucida Handwriting">Regards,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#00b050 size=6 face="Lucida Handwriting"><EM>AlD</EM></FONT></DIV></SPAN></SPAN>]]></content:encoded>
    </item>
  </channel>
</rss>