<?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>A British Geek in Texas Pontificates</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/adamhems/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/adamhems/feed.xml</link>
    <description />
    <lastBuildDate>Tue, 16 Apr 2019 04:27:38 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Enterprise Library 5 is out!</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/enterprise-library-5-is-out</link>
      <pubDate>Wed, 21 Apr 2010 07:51:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2010/04/21/enterprise-library-5-is-out/</guid>
      <description><![CDATA[Hopefully all you application Developers know about Enterprise Library, and how it can save you...]]></description>
      <content:encoded><![CDATA[<P>Hopefully all you application Developers know about Enterprise Library, and how it can save you development time and effort for commonly-performed task like database connections and logging. Well, prepare to have even more time and effort saved: Enterprise Library 5 was just released! No new blocks, just lots of improvements to what's already there plus support for VS 2010 &amp; .NET 4.0.</P>
<P>Read all about it here:</P>
<P><A href="https://blogs.msdn.com/agile/archive/2010/04/20/microsoft-enterprise-library-5-0-released.aspx" mce_href="https://blogs.msdn.com/agile/archive/2010/04/20/microsoft-enterprise-library-5-0-released.aspx">https://blogs.msdn.com/agile/archive/2010/04/20/microsoft-enterprise-library-5-0-released.aspx</A></P>]]></content:encoded>
    </item>
    <item>
      <title>Photosynth rocks!</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/photosynth-rocks</link>
      <pubDate>Fri, 13 Nov 2009 10:02:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2009/11/13/photosynth-rocks/</guid>
      <description><![CDATA[I'm an avid shutterbug and had the opportunity to explore some of Delhi, India's points of interest...]]></description>
      <content:encoded><![CDATA[<P>I'm an avid shutterbug and had the opportunity to explore some of Delhi, India's points of interest last weekend. I found myself with plenty of time while I was at one particular location - the 500 year old tomb of <A href="https://en.wikipedia.org/wiki/Isa_Khan_Niyazi" mce_href="https://en.wikipedia.org/wiki/Isa_Khan_Niyazi">Isa Khan Niyazi</A> (near to <A title="Humayun's Tomb" href="https://en.wikipedia.org/wiki/Humayun%27s_Tomb">Humayun's Tomb</A>) and I decided to have a go at creating a <STRONG>PhotoSynth</STRONG>. All this required was to take a huge number of photos of the site from pretty much every angle! I had a GPS with me too so I was able to <A href="https://en.wikipedia.org/wiki/Geotagging" mce_href="https://en.wikipedia.org/wiki/Geotagging">geotag</A> them when I got home (using Microsoft <A href="https://www.microsoft.com/prophoto/downloads/tools.aspx" mce_href="https://www.microsoft.com/prophoto/downloads/tools.aspx">Pro Photo Tools</A>.)</P>
<P>To create the Synth, I <A href="https://photosynth.net/create.aspx" mce_href="https://photosynth.net/create.aspx">downloaded the tool</A>, dragged-and-dropped all the photos I had taken of the location (612 of them!) on to it, and waited... My PC ran overnight and when it was done, this was the result:</P>
<P>&nbsp;<A href="https://photosynth.net/view.aspx?cid=ea9f844b-8ef8-43c1-ad74-06743e17f444">https://photosynth.net/view.aspx?cid=ea9f844b-8ef8-43c1-ad74-06743e17f444</A><BR></P>
<P>I'm rather pleased with how it came out! You can click around with the mouse, zoom in and out and generally explore the location very much like I actually did. All the 3D mapping etc. was done by the software, looking at the photos and working out what the place looked like! I didn't tell it a thing! Pretty amazing result, I thought.</P>
<P>There is also a 3D viewer version, which is also very cool:</P>
<P><A href="https://photosynth.net/d3d/photosynth.aspx?cid=ea9f844b-8ef8-43c1-ad74-06743e17f444">https://photosynth.net/d3d/photosynth.aspx?cid=ea9f844b-8ef8-43c1-ad74-06743e17f444</A></P>
<P>I shall do more of these :-)</P>
<P mce_keep="true">&nbsp;</P>]]></content:encoded>
    </item>
    <item>
      <title>A new way to avoid writing boring code</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/a-new-way-to-avoid-writing-boring-code</link>
      <pubDate>Fri, 20 Feb 2009 13:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2009/02/20/a-new-way-to-avoid-writing-boring-code/</guid>
      <description><![CDATA[Those who know me will be familiar with my quest to avoid writing boring code using any tool that...]]></description>
      <content:encoded><![CDATA[<P>Those who know me will be familiar with my quest to <A class="" href="https://blogs.msdn.com/adamhems/archive/2006/10/13/avoid-writing-boring-code-using-the-web-service-factory.aspx" mce_href="https://blogs.msdn.com/adamhems/archive/2006/10/13/avoid-writing-boring-code-using-the-web-service-factory.aspx">avoid writing boring code</A> using any tool that generates it for me (like CodeSmith + NetTiers or Software Factories). Thus it was with great excitement that I recently came across another one! It's called <A class="" href="https://msdn.microsoft.com/en-us/architecture/blueprints.aspx" mce_href="https://msdn.microsoft.com/en-us/architecture/blueprints.aspx">Microsoft Blueprints</A> and is the next evolution of those Software Factories I love so much. (GAT/GAX, which are the heart of Software Factories, are going into Maintenance Mode. Blueprints is What's Next in this space from Microsoft.)</P>
<P>I found a particularly good blog post that describes how to get going with&nbsp;Blueprints so if all you do is <A class="" href="https://afurtado1980.spaces.live.com/blog/cns!63514833CE40C143!1200.entry" target=_blank mce_href="https://afurtado1980.spaces.live.com/blog/cns!63514833CE40C143!1200.entry">read this</A> you will have a pretty good idea of what I'm so excited about... :-)</P>]]></content:encoded>
    </item>
    <item>
      <title>Using Custom Performance Counters to measure multi-threaded operation durations</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/using-custom-performance-counters-to-measure-multi-threaded-operation-durations</link>
      <pubDate>Thu, 04 Dec 2008 16:07:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2008/12/04/using-custom-performance-counters-to-measure-multi-threaded-operation-durations/</guid>
      <description><![CDATA[When building WCF Services it's very useful to know how long the individual operations within it's...]]></description>
      <content:encoded><![CDATA[<P>When building WCF Services it's very useful to know how long the individual operations within it's various methods are taking that are outside of the Service itself e.g. calls to other services or to databases as the question is often asked, "Why is this Service [in Production] so slow right now?" By firing up perfmon against the Production box&nbsp;and Admin can check the counters you've created for that Service and tell you which one is taking longer than usual to give you an indication of what steps to take next.</P>
<P>Creating custom counters is quite straightforward:</P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">PerformanceCounter _testCounter = <SPAN style="COLOR: blue">null</SPAN>;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">PerformanceCounter _testBaseCounter = <SPAN style="COLOR: blue">null</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; mso-no-proof: yes">string</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> _testCounterName = <SPAN style="COLOR: #a31515">"Test Counter"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; mso-no-proof: yes">string</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> _testBaseCounterName = <SPAN style="COLOR: #a31515">"Test Base Counter"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; mso-no-proof: yes">string</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> _performanceCounterCategory = <SPAN style="COLOR: #a31515">"Test Counters"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; mso-no-proof: yes">if</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> (!PerformanceCounterCategory.Exists(_performanceCounterCategory))<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CounterCreationData cdTestCounter = <SPAN style="COLOR: blue">new</SPAN> CounterCreationData();<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">cdTestCounter.CounterName = _testCounterName;<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">cdTestCounter.CounterType = PerformanceCounterType.AverageTimer32;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CounterCreationData cdTestBaseCounter = <SPAN style="COLOR: blue">new</SPAN> CounterCreationData();<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">cdTestBaseCounter.CounterName = _testBaseCounterName;<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">cdTestBaseCounter.CounterType = PerformanceCounterType.AverageBase;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; mso-no-proof: yes">// Add counters to the collection. Make sure Base Counters come after Timer Counters.<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CounterCreationDataCollection counterCreationDataCollection = <SPAN style="COLOR: blue">new</SPAN> CounterCreationDataCollection(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">new</SPAN> CounterCreationData[] { <o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">cdTestCounter,<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">cdTestBaseCounter<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>});<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; mso-no-proof: yes">// Create the category and pass the collection to it.<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">PerformanceCounterCategory.Create(_performanceCounterCategory, <SPAN style="COLOR: #a31515">"Test Performance Counter."</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="mso-tab-count: 1">&nbsp; </SPAN>PerformanceCounterCategoryType.SingleInstance, counterCreationDataCollection);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; mso-no-proof: yes">else<o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; mso-no-proof: yes">Console</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.WriteLine(<SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #a31515">"Performance Counter Category '{0}' already created."</SPAN>, _performanceCounterCategory));<o:p></o:p></SPAN></P>
<P mce_keep="true">And you'd think this would be ok in order to use them:</P>
<DIV style="BORDER-BOTTOM: windowtext 1.5pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-element: para-border-div"><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt; mso-bidi-font-family: 'Trebuchet MS'; mso-no-proof: yes"><o:p>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; mso-no-proof: yes">int</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT color=#000000> howLongToWait = </FONT><SPAN style="COLOR: blue">new</SPAN><FONT color=#000000> </FONT><SPAN style="COLOR: #2b91af">Random</SPAN><FONT color=#000000>().Next(1000, 2000);<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: #2b91af">Console</SPAN><FONT color=#000000>.WriteLine(</FONT><SPAN style="COLOR: blue">string</SPAN><FONT color=#000000>.Format(</FONT><SPAN style="COLOR: #a31515">"{0}: Waiting {1} ms"</SPAN><FONT color=#000000>, </FONT><SPAN style="COLOR: #2b91af">Thread</SPAN><FONT color=#000000>.CurrentThread.ManagedThreadId, howLongToWait));<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p><FONT color=#000000>&nbsp;</FONT></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">if</SPAN><FONT color=#000000> (_testCounter != </FONT><SPAN style="COLOR: blue">null</SPAN><FONT color=#000000>) _testCounter.RawValue = Stopwatch.GetTimestamp();</FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><FONT color=#000000><o:p></o:p></FONT></SPAN>&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: #2b91af">Thread</SPAN><FONT color=#000000>.Sleep(howLongToWait);<o:p></o:p></FONT></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p><FONT color=#000000>&nbsp;</FONT></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><SPAN style="mso-spacerun: yes"><FONT color=#000000>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></SPAN><SPAN style="COLOR: blue">if</SPAN><FONT color=#000000> (_testBaseCounter != </FONT><SPAN style="COLOR: blue">null</SPAN><FONT color=#000000>) _testBaseCounter.Increment();<o:p></o:p></FONT></SPAN></P>
<P style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-padding-alt: 0in 0in 1.0pt 0in; mso-layout-grid-align: none; mso-border-bottom-alt: solid windowtext 1.5pt" class=MsoNormal mce_keep="true">&nbsp;</P>
<P style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-padding-alt: 0in 0in 1.0pt 0in; mso-layout-grid-align: none; mso-border-bottom-alt: solid windowtext 1.5pt" class=MsoNormal>What you'd expect to happen when you fire up perfmon on your nice new Performance Counter is that you would see the value the same as "howLongToWait" in the code above every time the last line of the code above executes (it reverts to zero shortly after). HOWEVER when you run this code in <EM>multiple threads, </EM>then the time taken to execute your method will be reported as much shorter than you know it to be; the more threads - the quicker it appears to run!</P>
<P style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-padding-alt: 0in 0in 1.0pt 0in; mso-layout-grid-align: none; mso-border-bottom-alt: solid windowtext 1.5pt" class=MsoNormal mce_keep="true">&nbsp;</P>
<P style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-padding-alt: 0in 0in 1.0pt 0in; mso-layout-grid-align: none; mso-border-bottom-alt: solid windowtext 1.5pt" class=MsoNormal>Luckily the solution is quite simple (and maybe you've thought of it already, but it took me a while...):</P>
<P style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-padding-alt: 0in 0in 1.0pt 0in; mso-layout-grid-align: none; mso-border-bottom-alt: solid windowtext 1.5pt" class=MsoNormal mce_keep="true">&nbsp;</P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: blue">long</SPAN> ticksAtStart = <SPAN style="COLOR: #2b91af">Stopwatch</SPAN>.GetTimestamp(); <SPAN style="COLOR: green">// Record the start-time<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: #2b91af">Thread</SPAN>.Sleep(howLongToWait); <SPAN style="COLOR: green">// Wait</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: blue">if</SPAN> (_testCounter != <SPAN style="COLOR: blue">null</SPAN>) _testCounter.IncrementBy(<SPAN style="COLOR: #2b91af">Stopwatch</SPAN>.GetTimestamp() - ticksAtStart); <SPAN style="COLOR: green">// Thread Safe!</SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: green"></SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: blue">if</SPAN> (_testBaseCounter != <SPAN style="COLOR: blue">null</SPAN>) _testBaseCounter.Increment(); <SPAN style="COLOR: green">// This tells the counter one iteration has happened</SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="COLOR: green"></SPAN></SPAN>&nbsp;</P>
<P style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-padding-alt: 0in 0in 1.0pt 0in; mso-layout-grid-align: none; mso-border-bottom-alt: solid windowtext 1.5pt" class=MsoNormal>Here is a full example in case this helps. Run it as a console app and point perfmon at a a Category "Test Counters" and monitor the counter "Test Counter" and you should see values that are more like you'd expect (however depending on the frequency of the updates and the umber of theads you might not see every setting the application makes.)</SPAN></FONT></FONT></SPAN></o:p></SPAN></P>
<P style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-padding-alt: 0in 0in 1.0pt 0in; mso-layout-grid-align: none; mso-border-bottom-alt: solid windowtext 1.5pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt; mso-bidi-font-family: 'Trebuchet MS'; mso-no-proof: yes"><o:p></o:p></SPAN>&nbsp;</P></DIV>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt; mso-bidi-font-family: 'Trebuchet MS'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">using</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> System;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">using</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> System.Threading;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">using</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> System.Diagnostics;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt; mso-no-proof: yes">namespace</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"> Test<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">class</SPAN> <SPAN style="COLOR: #2b91af">Program<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> Main(<SPAN style="COLOR: blue">string</SPAN>[] args)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">for</SPAN> (<SPAN style="COLOR: blue">int</SPAN> i = 0; i &lt; 10; i++)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: #a31515">"Scheduling New Task..."</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">ThreadPool</SPAN>.QueueUserWorkItem(<SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">WaitCallback</SPAN>(DoSomething));<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">private</SPAN> <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> DoSomething(<SPAN style="COLOR: blue">object</SPAN> state)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">TestClass</SPAN> testClass = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">TestClass</SPAN>();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>testClass.DoSomething();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">class</SPAN> <SPAN style="COLOR: #2b91af">TestClass<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">PerformanceCounter</SPAN> _testCounter = <SPAN style="COLOR: blue">null</SPAN>; <SPAN style="COLOR: green">// Main timer counter</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">PerformanceCounter</SPAN> _testBaseCounter = <SPAN style="COLOR: blue">null</SPAN>; <SPAN style="COLOR: green">// We need two counters to measure a duration.</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">string</SPAN> _testCounterName = <SPAN style="COLOR: #a31515">"Test Counter"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">string</SPAN> _testBaseCounterName = <SPAN style="COLOR: #a31515">"Test Base Counter"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">string</SPAN> _performanceCounterCategory = <SPAN style="COLOR: #a31515">"Test Counters"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">public</SPAN> TestClass()<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Init Perf Counters in Constructor</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (!<SPAN style="COLOR: #2b91af">PerformanceCounterCategory</SPAN>.Exists(_performanceCounterCategory))<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CounterCreationData</SPAN> cdTestCounter = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">CounterCreationData</SPAN>();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>cdTestCounter.CounterName = _testCounterName;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>cdTestCounter.CounterType = <SPAN style="COLOR: #2b91af">PerformanceCounterType</SPAN>.AverageTimer32;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CounterCreationData</SPAN> cdTestBaseCounter = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">CounterCreationData</SPAN>();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>cdTestBaseCounter.CounterName = _testBaseCounterName;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>cdTestBaseCounter.CounterType = <SPAN style="COLOR: #2b91af">PerformanceCounterType</SPAN>.AverageBase;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Add counters to the collection. Make sure Base Counters come after Timer Counters.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">CounterCreationDataCollection</SPAN> counterCreationDataCollection = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">CounterCreationDataCollection</SPAN>(<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">CounterCreationData</SPAN>[] { <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>cdTestCounter,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>cdTestBaseCounter<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>});<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: green">// Create the category and pass the collection to it.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">PerformanceCounterCategory</SPAN>.Create(_performanceCounterCategory, <SPAN style="COLOR: #a31515">"Test Performance Counter."</SPAN>,<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">PerformanceCounterCategoryType</SPAN>.SingleInstance, counterCreationDataCollection);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">else<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #a31515">"Performance Counter Category '{0}' already created."</SPAN>, _performanceCounterCategory));<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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">public</SPAN> <SPAN style="COLOR: blue">void</SPAN> DoSomething()<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (!<SPAN style="COLOR: #2b91af">PerformanceCounterCategory</SPAN>.Exists(_performanceCounterCategory))<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #a31515">"Not collecting Performance Statistics for this call; PerformanceCounterCategory {0} not found."</SPAN>, _performanceCounterCategory));<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">return</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (<SPAN style="COLOR: #2b91af">PerformanceCounterCategory</SPAN>.CounterExists(_testCounterName, _performanceCounterCategory))<SPAN style="COLOR: green"><o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>_testCounter = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">PerformanceCounter</SPAN>(_performanceCounterCategory, _testCounterName, <SPAN style="COLOR: blue">false</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (<SPAN style="COLOR: #2b91af">PerformanceCounterCategory</SPAN>.CounterExists(_testBaseCounterName, _performanceCounterCategory))<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>_testBaseCounter = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">PerformanceCounter</SPAN>(_performanceCounterCategory, _testBaseCounterName, <SPAN style="COLOR: blue">false</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">while</SPAN> (<SPAN style="COLOR: blue">true</SPAN>)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">int</SPAN> howLongToWait = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">Random</SPAN>().Next(1000, 2000);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: blue">string</SPAN>.Format(<SPAN style="COLOR: #a31515">"{0}: Waiting {1} ms"</SPAN>, <SPAN style="COLOR: #2b91af">Thread</SPAN>.CurrentThread.ManagedThreadId, howLongToWait));<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">long</SPAN> ticksAtStart = <SPAN style="COLOR: #2b91af">Stopwatch</SPAN>.GetTimestamp(); <SPAN style="COLOR: green">// Record the start-time<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: #2b91af">Thread</SPAN>.Sleep(howLongToWait); <SPAN style="COLOR: green">// Wait</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (_testCounter != <SPAN style="COLOR: blue">null</SPAN>) _testCounter.IncrementBy(<SPAN style="COLOR: #2b91af">Stopwatch</SPAN>.GetTimestamp() - ticksAtStart); <SPAN style="COLOR: green">// Set the Counter</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">if</SPAN> (_testBaseCounter != <SPAN style="COLOR: blue">null</SPAN>) _testBaseCounter.Increment(); <SPAN style="COLOR: green">// This tells the counter one iteration has happened</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><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>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<DIV style="BORDER-BOTTOM: windowtext 1.5pt solid; BORDER-LEFT: medium none; PADDING-BOTTOM: 1pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-element: para-border-div">
<P style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: medium none; BORDER-RIGHT: medium none; PADDING-TOP: 0in; mso-padding-alt: 0in 0in 1.0pt 0in; mso-layout-grid-align: none; mso-border-bottom-alt: solid windowtext 1.5pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-no-proof: yes">}<o:p></o:p></SPAN></P></DIV>]]></content:encoded>
    </item>
    <item>
      <title>Leveraging multi-threading when calling Web Services or SQL Server</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/leveraging-multi-threading-when-calling-web-services-or-sql-server</link>
      <pubDate>Wed, 15 Oct 2008 14:52:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2008/10/15/leveraging-multi-threading-when-calling-web-services-or-sql-server/</guid>
      <description><![CDATA[If you need to make more than one call to one or more web services in your code in a single request,...]]></description>
      <content:encoded><![CDATA[<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt">If you need to make more than one call to one or more web services in your code in a single request, then you can do this using multiple threads for vastly better performance. </SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt">There are three ways of solving this problem, depending upon which layer your code resides (UI, Business Layer or Data Layer).<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt">If your code is in the UI layer, then you can make use of the Async parameter in your ASPX: <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid black .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: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 778.1pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt" vAlign=top width=1037>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&lt;%@ </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: maroon; FONT-SIZE: 10pt">Page</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: fuchsia; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">Language</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">="C#"</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: fuchsia; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">Async</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">="true"</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: fuchsia; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">CompileWith</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">="SlowWSAsync.aspx.cs"</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: fuchsia; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: red; FONT-SIZE: 10pt">ClassName</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">="Whatever.SlowWSAsync_aspx"</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: fuchsia; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">%&gt;<o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Segoe UI','sans-serif'; COLOR: blue; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt">like this (SlowWsAsync.aspx.cs):<o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Segoe UI','sans-serif'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;<o:p></o:p></SPAN></P>
<TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid black .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: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 764.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt" vAlign=top width=1019>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: navy">…</SPAN><SPAN style="FONT-FAMILY: 'Courier New'"><o:p></o:p></SPAN></FONT></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><FONT size=3><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue">using</SPAN><SPAN style="FONT-FAMILY: 'Courier New'"> System.Threading;<o:p></o:p></SPAN></FONT></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt; mso-bidi-font-family: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">namespace</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'"><FONT size=3>Chevron.UpstreamArchitecture.Services.</FONT></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">Whatever</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">{</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp; public partial class </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">SlowWSAsync_aspx</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp; </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">{</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">// Get an instance of our Slow Web Service</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; Slow</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">slowWebservice</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> new </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">Slow</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">();</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt; mso-bidi-font-family: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; void </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">Page_Load</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">(object </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">sender,</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">EventArgs</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">e</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">)<o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">{</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BeginEventHandler</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">bh =</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> new </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">BeginEventHandler</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">(this</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">.BeginGetAsyncData);</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EndEventHandler</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">eh =</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> new </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">EndEventHandler</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">(this</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">.EndGetAsyncData);</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddOnPreRenderCompleteAsync(bh, eh);</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; }</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;<o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; IAsyncResult</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">BeginGetAsyncData</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">(</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">Object</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">src, </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">EventArgs</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">args, </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">AsyncCallback</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">cb, </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">Object</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">state)</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">&nbsp;&nbsp; {</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Note - this is serviced on the same thread as Page_Load</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // but a different thread is used to service EndGetAsyncData</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">slowWebservice.DoWhatever(cb, state);</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; }</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;<o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;void </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">EndGetAsyncData(</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">IAsyncResult</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">ar)</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; {</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">ret = slowWebservice.DoWhatever (ar);</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">}</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">&nbsp; }</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">}</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Segoe UI','sans-serif'; COLOR: blue; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt">If you’re in the Business layer, then you can use something like this: <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid black .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: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 859.1pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt" vAlign=top width=1145>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: navy; FONT-SIZE: 10pt">…</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">using</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> System.Threading;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">namespace</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> Chevron.UpstreamArchitecture.Services.Whatever<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">ConsoleApp<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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 style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">DoStuffSimultaneously</SPAN> doit = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">DoStuffSimultaneously</SPAN>();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Call our method, passing in the data we want it to work on in parallel.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">string</SPAN> stringsAppendedInMulitpleThreads = doit.DoStuff(<SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">string</SPAN>[] { <SPAN style="COLOR: #a31515">"one "</SPAN>, <SPAN style="COLOR: #a31515">"two "</SPAN>, <SPAN style="COLOR: #a31515">"three "</SPAN> });<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Spit out the results<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(stringsAppendedInMulitpleThreads);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">DoStuffSimultaneously<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">string</SPAN> _response = <SPAN style="COLOR: blue">string</SPAN>.Empty; // <SPAN style="COLOR: green">Common object the threads update with their work.</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">AutoResetEvent</SPAN>[] _waitAllEvents; // <SPAN style="COLOR: green">Array of objects to wait upon.</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray">&lt;summary&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> This method takes in a set of work and calls multiple threads for each unit of work.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray">&lt;/summary&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray">&lt;param name="whatToDo"&gt;</SPAN><SPAN style="COLOR: green">An array of strings to be appended together, each by a different thread.</SPAN><SPAN style="COLOR: gray">&lt;/param&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray">&lt;returns&gt;</SPAN><SPAN style="COLOR: green">The result of all the multiple threads' work.</SPAN><SPAN style="COLOR: gray">&lt;/returns&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">public</SPAN> <SPAN style="COLOR: blue">string</SPAN> DoStuff(<SPAN style="COLOR: blue">string</SPAN>[] whatToDo)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Create an array of objects to wait upon; we need one per thread<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _waitAllEvents = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">AutoResetEvent</SPAN>[whatToDo.Count];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Populate array of waiting objects, one for each work item<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">for</SPAN> (<SPAN style="COLOR: blue">int</SPAN> i = 0; i &lt; whatToDo.Count; i++) <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _waitAllEvents[i] = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">AutoResetEvent</SPAN>(<SPAN style="COLOR: blue">false</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Create callback on the method we want to do the work<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">WaitCallback</SPAN> callBack = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">WaitCallback</SPAN>(CallSlowWebServiceInNewThread);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Iterate through all our work items, creating a thread for each and passing in the data<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// we want the thread to work on and the event we are waiting on as a state object (a Pair in this example - could be any object)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">for</SPAN>(<SPAN style="COLOR: blue">int</SPAN> i=0; i &lt; whatToDo.Count; i++) <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">ThreadPool</SPAN>.QueueUserWorkItem(callBack, <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">Pair</SPAN>(whatToDo[i], _waitAllEvents[i]));<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Wait until all our threads have signaled their wait object is done.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">if</SPAN> (<SPAN style="COLOR: #2b91af">Thread</SPAN>.CurrentThread.GetApartmentState() == <SPAN style="COLOR: #2b91af">ApartmentState</SPAN>.STA)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// WaitAll for multiple handles on an STA thread is not supported.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// ...so wait on each handle individually.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">WaitHandle</SPAN> myWaitHandle <SPAN style="COLOR: blue">in</SPAN> _waitAllEvents)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">WaitHandle</SPAN>.WaitAny(<SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">WaitHandle</SPAN>[] { myWaitHandle });<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">else<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: navy"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></SPAN><SPAN style="COLOR: #2b91af">WaitHandle</SPAN>.WaitAll(_waitAllEvents);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// When we get here then all our threads have done their work, so we can return our result object.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">return</SPAN> _response;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray">&lt;summary&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> This method calls our slow web service</SPAN><SPAN style="COLOR: navy"> </SPAN><SPAN style="COLOR: green">does some work in a separate thread.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray">&lt;/summary&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: gray">///</SPAN><SPAN style="COLOR: green"> </SPAN><SPAN style="COLOR: gray">&lt;param name="state"&gt;</SPAN><SPAN style="COLOR: green">A Pair object containing a string as the work item, and a AutoResetEvent to set when we are done.</SPAN><SPAN style="COLOR: gray">&lt;/param&gt;<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">static</SPAN> <SPAN style="COLOR: blue">void</SPAN> CallSlowWebServiceInNewThread(<SPAN style="COLOR: blue">object</SPAN> state)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Get the work for this thread out of the pair<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">Pair</SPAN> pair = state <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: #2b91af">Pair</SPAN>;</SPAN><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt; mso-bidi-font-family: 'Courier New'"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">// Get an instance of our Slow Web Service</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-ALIGN: justify; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: #2b91af; FONT-SIZE: 10pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>Slow</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">slowWebservice</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">=</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"> new </SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: teal; FONT-SIZE: 10pt">Slow</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: black; FONT-SIZE: 10pt">();</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Call slow Web Service using our work item (be careful of race conditions here; so lock work item)<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">lock</SPAN> (_response)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Get something from our Slow WebService<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _response += <SPAN style="COLOR: black">slowWebservice.DoSomething(pair</SPAN>.First<SPAN style="COLOR: navy">)</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Get our wait item out of the pair<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">AutoResetEvent</SPAN> autoResetEvent = pair.Second <SPAN style="COLOR: blue">as</SPAN> <SPAN style="COLOR: #2b91af">AutoResetEvent</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Set our wait item to indicate we are done here.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; autoResetEvent.Set();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">}<o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt">Finally, if your code is in the Data Layer and you’re calling directly against SQL Server with a bunch of slow queries then you can use something like the code example below to have SQL Server work on them simultaneously and tell us when it’s done with them. <o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<TABLE style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; BORDER-COLLAPSE: collapse; BORDER-TOP: medium none; BORDER-RIGHT: medium none; mso-border-alt: solid black .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: black 1pt solid; BORDER-LEFT: black 1pt solid; PADDING-BOTTOM: 0in; BACKGROUND-COLOR: transparent; PADDING-LEFT: 5.4pt; WIDTH: 773.6pt; PADDING-RIGHT: 5.4pt; BORDER-TOP: black 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-alt: solid black .5pt" vAlign=top width=1031>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: navy; FONT-SIZE: 10pt">…</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">using</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> System.Threading;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">namespace</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> Chevron.UpstreamArchitecture.Services.Whatever<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">class</SPAN> <SPAN style="COLOR: #2b91af">ExecSimultAsyncSqlStatementWaitAll<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Command-line app to demo launching loads of *simultaneous* SQL commands and <o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt 0.5in" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">&nbsp; // waiting for them all to come back, where we can deal with all them in one loop.</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P>
<P style="TEXT-INDENT: 0.5in; MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: blue; FONT-SIZE: 10pt">&nbsp; static</SPAN><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"> <SPAN style="COLOR: blue">void</SPAN> Main(<SPAN style="COLOR: blue">string</SPAN>[] args)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Note "Asynchronous Processing=true" at the end of the connection string...<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">string</SPAN> sqlConnectString = <SPAN style="COLOR: #a31515">"Data Source=whatever;Integrated Security=SSPI;"</SPAN> +<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #a31515">"Initial Catalog=whatever;Asynchronous Processing=true"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// This is just used to make SQL Server wait a random few seconds to simulate a long query<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">Random</SPAN> rnd = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">Random</SPAN>((<SPAN style="COLOR: blue">int</SPAN>)<SPAN style="COLOR: #2b91af">DateTime</SPAN>.Now.Ticks);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Create an array of SQL commands with "n" members to simulate a batch of work to do<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">int</SPAN> n = 10;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">SqlConnection</SPAN>[] connection = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">SqlConnection</SPAN>[n];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">SqlCommand</SPAN>[] command = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">SqlCommand</SPAN>[n];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">string</SPAN>[] sqlSelect = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: blue">string</SPAN>[n];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">IAsyncResult</SPAN>[] asyncResult = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">IAsyncResult</SPAN>[n];<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">WaitHandle</SPAN>[]<SPAN style="COLOR: navy"> _</SPAN>waitAllEvents = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">WaitHandle</SPAN>[n]; <SPAN style="COLOR: green">// This object is what we use to wait on the batch<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// Kick off 10 select statements that will run simultaneously; we DON'T wait for each one here<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">for</SPAN> (<SPAN style="COLOR: blue">int</SPAN> i = 0; i &lt; n; i++)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// In this example, each command actually just waits for between 1 and 10 random seconds<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// In reality this could just be a slow query.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sqlSelect[i] = <SPAN style="COLOR: #a31515">"WAITFOR DELAY '00:00:"</SPAN> + rnd.Next(1, 10) + <SPAN style="COLOR: #a31515">"';"</SPAN>;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connection[i] = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">SqlConnection</SPAN>(sqlConnectString);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connection[i].Open();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command[i] = <SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">SqlCommand</SPAN>(sqlSelect[i], connection[i]);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: green">// Kick off a call to SQL Server; it will return *instantly* with an object we can wait upon<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; asyncResult[i] = command[i].BeginExecuteNonQuery();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: #a31515">"[{0}] Command {1} started: {2}"</SPAN>, <SPAN style="COLOR: #2b91af">DateTime</SPAN>.Now, i, sqlSelect[i]);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// capture something to wait on for this command<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wh[i] = asyncResult[i].AsyncWaitHandle;<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: navy; FONT-SIZE: 10pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt">// Wait for all processes to complete and output results<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">if</SPAN> (<SPAN style="COLOR: #2b91af">Thread</SPAN>.CurrentThread.GetApartmentState() == <SPAN style="COLOR: #2b91af">ApartmentState</SPAN>.STA)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// WaitAll for multiple handles on an STA thread is not supported.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: green">// ...so wait on each handle individually.<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: #2b91af">WaitHandle</SPAN> myWaitHandle <SPAN style="COLOR: blue">in</SPAN> _waitAllEvents)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">WaitHandle</SPAN>.WaitAny(<SPAN style="COLOR: blue">new</SPAN> <SPAN style="COLOR: #2b91af">WaitHandle</SPAN>[] { myWaitHandle });<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">else<o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: navy"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN><SPAN style="COLOR: #2b91af">WaitHandle</SPAN>.WaitAll(<SPAN style="COLOR: navy">_</SPAN>waitAllEvents);<SPAN style="COLOR: green"><o:p></o:p></SPAN></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt; mso-bidi-font-family: 'Courier New'"><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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; COLOR: green; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">for</SPAN> (<SPAN style="COLOR: blue">int</SPAN> i = 0; i &lt; wh.Length; i++)<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: blue">int</SPAN> recAff = command[i].EndExecuteNonQuery(asyncResult[i]); <SPAN style="COLOR: green">// Get back the results of each query</SPAN><o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: #a31515">"[{0}] Command {1} completed, records affected = {2}"</SPAN>, <SPAN style="COLOR: #2b91af">DateTime</SPAN>.Now, i, recAff);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connection[i].Close();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">Console</SPAN>.WriteLine(<SPAN style="COLOR: #a31515">"\nPress any key to continue."</SPAN>);<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <SPAN style="COLOR: #2b91af">Console</SPAN>.ReadKey();<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; }<o:p></o:p></SPAN></P>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt">}</SPAN><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; FONT-SIZE: 10pt"><o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE>
<P style="MARGIN: 0in 0in 0pt" class=MsoNormal><SPAN style="FONT-FAMILY: 'Trebuchet MS','sans-serif'; COLOR: navy; FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>Terrarium is back!</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/terrarium-is-back</link>
      <pubDate>Mon, 08 Sep 2008 11:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2008/09/08/terrarium-is-back/</guid>
      <description><![CDATA["Terrarium" is a project Microsoft created with .NET 1.0 that allowed devs to write a bug or plant...]]></description>
      <content:encoded><![CDATA[<P>"Terrarium" is a project Microsoft created with .NET 1.0 that allowed devs to write a bug or plant and have it live, fight and eat in a little digital world called Terrarium. This world connected to other instances running on other folks PC's and your bug could crawl between them and live on, even reproduce, in other people instances of Terrarium and thrive or become food for another dev's creature that was better at survival than yours. Survival of the best-programmed! You couldn't change anything about the world but you had quite a lot of creative freedom in creating your bug (or plant - not that the plants did a lot!) They could communicate and even pass on genetic traits to thier children. It was cool.</P>
<P>Well it went away, which is a shame; but recently was revived! Check it out!!</P>
<P><A href="https://weblogs.asp.net/bsimser/archive/2008/07/16/reintroducing-terrarium-now-with-2-0-goodness.aspx">https://weblogs.asp.net/bsimser/archive/2008/07/16/reintroducing-terrarium-now-with-2-0-goodness.aspx</A></P>
<P>Now for the really hard part... What to call my first critter...</P>]]></content:encoded>
    </item>
    <item>
      <title>Distributed Caching in .NET</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/distributed-caching-in-net</link>
      <pubDate>Tue, 10 Jun 2008 14:23:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2008/06/10/distributed-caching-in-net/</guid>
      <description><![CDATA[Saw this today and thought this...]]></description>
      <content:encoded><![CDATA[<P>Saw this today and thought this intesting:</P>
<P>&nbsp;<A href="https://msdn.microsoft.com/en-us/library/cc645013.aspx" mce_href="https://msdn.microsoft.com/en-us/library/cc645013.aspx">https://msdn.microsoft.com/en-us/library/cc645013.aspx</A></P>
<P>Bits and a sample are available:</P>
<P><A href="https://msdn.microsoft.com/en-us/data/cc655792.aspx">https://msdn.microsoft.com/en-us/data/cc655792.aspx</A></P>
<P>Until now the only caching option from Microsoft has been the Caching block from the P&amp;P group. This offering (code named "<STRONG>Velocity</STRONG>") really ups the ante...</P>]]></content:encoded>
    </item>
    <item>
      <title>Aspiring Architects Webcasts this Month</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/aspiring-architects-webcasts-this-month</link>
      <pubDate>Fri, 06 Jun 2008 13:18:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2008/06/06/aspiring-architects-webcasts-this-month/</guid>
      <description><![CDATA[I saw these Webcasts coming up this month and think they might be of interest to a lot of folks (all...]]></description>
      <content:encoded><![CDATA[<P>I saw these Webcasts coming up this month and think they might be of interest to a lot of folks (all times are Eastern time):</P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'">June 16th, 2008 – 12:00 p.m. to 1:00 p.m. – <B style="mso-bidi-font-weight: normal">Introduction to the aspiring architect Web Cast series</B><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt 0.5in"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'"><A href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380836">https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380836</A><o:p></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'">June 17th, 2008 – 12:00 p.m. to 1:00 p.m. – <B style="mso-bidi-font-weight: normal">Services Oriented Architecture and Enterprise Service Bus – Beyond the hype</B><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt 0.5in"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'"><A href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380838">https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380838</A><o:p></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'">June 18th, 2008 – 12:00 p.m. to 1:00 p.m. – <B style="mso-bidi-font-weight: normal">TOGAF and Zachman, a real-world perspective</B><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt 0.5in"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'"><A href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380840">https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380840</A><o:p></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'">June 23rd , 2008 – 12:00 p.m. to 1:00 p.m. – <B style="mso-bidi-font-weight: normal">Realizing dynamic systems</B><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt 0.5in"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'"><A href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380846">https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380846</A><o:p></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'">June 24th, 2008 – 12:00 p.m. to 1:00 p.m. – <B style="mso-bidi-font-weight: normal">Web 2.0, beyond the hype</B><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt 0.5in"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'"><A href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380848">https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380848</A><o:p></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'">June 25th, 2008 – 12:00 p.m. to 1:00 p.m. – <B style="mso-bidi-font-weight: normal">Architecting for the user experience</B><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt 0.5in"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'"><A href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380850">https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380850</A><o:p></o:p></SPAN></P>
<P class=MsoListParagraph style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<SPAN style="FONT: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN></SPAN></SPAN><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'">June 26th, 2008 – 12:00 p.m. to 1:00 p.m. – <B style="mso-bidi-font-weight: normal">Conclusion and next steps</B><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt 0.5in"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'"><A href="https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380852">https://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032380852</A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 10pt"><SPAN style="FONT-SIZE: 10pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Trebuchet MS','sans-serif'"><o:p>&nbsp;</o:p></SPAN></P>]]></content:encoded>
    </item>
    <item>
      <title>.NET: What's coming down the Pike</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/net-whats-coming-down-the-pike</link>
      <pubDate>Mon, 12 May 2008 16:21:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2008/05/12/net-whats-coming-down-the-pike/</guid>
      <description><![CDATA[Today there a bunch of new bits to play with that have up until now been a collection of individual...]]></description>
      <content:encoded><![CDATA[<P>Today there a bunch of new bits to play with that have up until now been a collection of individual CTP's - yes it's the first beta of Visual Studio 2008 and .NET Framework 3.5 Service Pack 1! This is more interesting than&nbsp;many betas&nbsp;as there <EM>a <U>lot</U></EM> of new stuff in this Service Pack, not just bug fixes;&nbsp;including&nbsp;all of my most-anticipated new features:</P>
<UL>
<LI><STRONG>ASP.NET Data Scaffolding Support</STRONG> (ASP.NET Dynamic Data) - this is not dissimilar to Ruby On Rails in that it gets you to a web site in front of a database <EM>very</EM> quickly (and with minimal, possibly no, code) - really cool</LI>
<LI><STRONG>ADO.NET Entity Framework</STRONG> (and LINQ to Entities) - basically a very powerful, flexible&nbsp;ORM which, among other things,&nbsp;supports inheritance! Entities can be used in WCF, too. This is my favourite new feature :-)</LI>
<LI><STRONG>ADO.NET Data Services </STRONG>(was called "Astoria"): This is basically REST-based data services (including a LINQ Client that queries them); when used with the Entity Framework (optional, but cool) you can <EM>very </EM>quickly publish a really simple to use yet powerful API directly to your data schema - so cool&nbsp;(my second favourite new feature!)</LI></UL>
<P>These three alone will save a <EM>ton</EM> of code... I can't wait!! To learn more and see all the other stuff included in this Service Pack coming your way <STRONG>soon</STRONG>,&nbsp;be sure to&nbsp;<A class="" href="https://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx" target=_blank mce_href="https://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx">read this</A>.</P>]]></content:encoded>
    </item>
    <item>
      <title>Enterprise Library and WCF</title>
      <link>https://docs.microsoft.com/archive/blogs/adamhems/enterprise-library-and-wcf</link>
      <pubDate>Mon, 12 May 2008 09:32:00 GMT</pubDate>
      <dc:creator><![CDATA[Adam Hems]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/adamhems/2008/05/12/enterprise-library-and-wcf/</guid>
      <description><![CDATA[If you're creating Web Services using WCF (or ASMX, for that matter) then you are, of course, using...]]></description>
      <content:encoded><![CDATA[<P>If you're creating Web Services using WCF (or ASMX, for that matter) then you are, of course, using the <A class="" href="https://www.codeplex.com/servicefactory" target=_blank mce_href="https://www.codeplex.com/servicefactory">Web Service Software Factory</A> to create them (right?). Well one thing the WSSF does not include is the hooks to the various blocks within the Enterprise Library that many would find useful in tier freshly-generated Web Services; like Validation, Exception Handling and Logging, Performance Counters, Caching and Exception Shielding. These have to be manually added after you've generated your code.</P>
<P>Well recently a team from Avenade decided to fix this problem and have released to CodePlex an extension to the WSSF called the "<A class="" href="https://codeplex.com/EntLibExtensionsWSSF" target=_blank mce_href="https://codeplex.com/EntLibExtensionsWSSF">EntLib Extensions To WSSF</A>". Once installed (a matter of copying the dll's and updated configuration XML in the appropriate place) you get an additional option when choosing the implementation technology - "WCF with Entlib". Choosing this exposes a slew of new options within your Model that permits you to add all the logging, caching etc. hooks you like; you just need to use the EntLib Configuration tool on your finished Solution (just as you ordinarily would) in order to Make It Work, which is a lot simpler :-)<BR></P>]]></content:encoded>
    </item>
  </channel>
</rss>