<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>r2 musings - rants, raves, and research (mostly on .NET topics) from rik robinson - Generics</title>
    <link>http://www.r2musings.com/</link>
    <description>rants, raves, and research (mostly on .NET topics) from rik robinson</description>
    <language>en-us</language>
    <copyright>Rik Robinson</copyright>
    <lastBuildDate>Fri, 25 Jan 2008 07:53:51 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>r2@r2musings.com</managingEditor>
    <webMaster>r2@r2musings.com</webMaster>
    <item>
      <trackback:ping>http://www.r2musings.com/Trackback.aspx?guid=c5527d87-55c1-47fa-a349-bbd955d7c2be</trackback:ping>
      <pingback:server>http://www.r2musings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.r2musings.com/PermaLink,guid,c5527d87-55c1-47fa-a349-bbd955d7c2be.aspx</pingback:target>
      <dc:creator>Rik Robinson</dc:creator>
      <wfw:comment>http://www.r2musings.com/CommentView,guid,c5527d87-55c1-47fa-a349-bbd955d7c2be.aspx</wfw:comment>
      <wfw:commentRss>http://www.r2musings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c5527d87-55c1-47fa-a349-bbd955d7c2be</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In mathematics, a Set is typically thought of as a collection of <strong>distinct</strong> objects
that is usually defined by some rule that determines whether they are a member of
that particular Set.  For example, a Set could be defined to contain "all the
odd numbers under 100" or "every number divisible by 2" or whatever.  The main
points here being that the objects in a Set are distinct (i.e. NO duplicate objects
are allowed) and the objects are not ordered or sorted in any way.  (If you really
feel the need to geek out on Set Theory, be my <a href="http://en.wikipedia.org/wiki/Set" target="_blank">guest</a>).
</p>
        <p>
According to the <a href="http://msdn2.microsoft.com/en-us/library/bb359438.aspx" target="_blank">MSDN
Documentation for HashSet</a>, "a set is a collection that contains no duplicate elements,
and whose elements are in no particular order."  Sound familiar?  In the
.NET Base Class Library, there has never been a true Set class until now with the
release of .NET 3.5 and the brand-spanking-new System.Collections.Generic.HashSet&lt;T&gt;
class.  
</p>
        <p>
In the past, when we needed to implement a Set in .NET, we sort of bastardized the
List&lt;T&gt; or other unsuspecting Collection classes into something like this:
</p>
        <blockquote>
          <p>
int[] intArray = new int[]{ 1, 2, 5, 7, 4, 1, 7, 9, 8}; 
<br />
List&lt;int&gt; intList = new List&lt;int&gt;(); 
<br />
foreach(int theInt in intArray) 
<br />
{ 
<br />
  // checking to make sure that the object is not in our List before adding 
<br />
  //  so we are calling Contains() and then Add() on every time through
the loop 
<br />
  if (!intList.Contains(theInt)) 
<br />
    intList.Add(theInt); 
<br />
}
</p>
        </blockquote>
        <p>
What we needed was a Set that would let us just keep adding objects to it and free
us from having to worry about it being there first.  A recent example of when
I really needed a true Set class was while working on the <a href="http://silverlight.r2musings.com/weatherwidget" target="_blank">Weather
Widget</a>.  <a href="http://www.weather.com" target="_blank">The Weather Channel</a> provides
some 40+ images for use in their SDK, yet in the Weather Widget I never need more
than maximum of 11 (and usually less as there is usually duplication).  So, I
had the idea to dynamically zip the images that I actually needed for a given Zip
Code and use that file for my image assets in Silverlight via CreateXamlFromDownloader. 
Obviously, I don't want these images duplicated in the zip file.  So, I came
up with this: 
</p>
        <blockquote>
          <p>
HashSet&lt;string&gt; assets = new HashSet&lt;string&gt;(); 
<br />
foreach (ForecastDay day in forecast.Days) 
<br />
{ 
<br />
  // no Exception here if duplicate...it just doesn't add it. 
<br />
  assets.Add(Server.MapPath(String.Format("~/images/{0}", day.IconDay))); 
<br />
} 
<br />
Utility.WriteZipFile(assets.ToArray&lt;string&gt;()) 
</p>
        </blockquote>
        <p>
This just scratches the surface of what HashSet&lt;T&gt; is capable of.  There
are member methods available for most Set operations, such as <a href="http://msdn2.microsoft.com/en-us/library/bb293080.aspx">IntersectWith</a>(), <a href="http://msdn2.microsoft.com/en-us/library/bb342097.aspx">UnionWith</a>(), <a href="http://msdn2.microsoft.com/en-us/library/bb358446.aspx">IsSubsetOf</a>(), <a href="http://msdn2.microsoft.com/en-us/library/bb346923.aspx">IsSupersetOf</a>(),
RemoveWhere(), etc.   Here's a link to all of the <a href="http://msdn2.microsoft.com/en-us/library/bb341004.aspx" target="_blank">HashSet&lt;T&gt;
Members</a>.
</p>
        <p>
Recall that being a member of a set depends on <em>some rule</em> that determines
this membership.  With the HashSet&lt;T&gt;, you can define your own rule of
what it means to be in a Set.  For a good example of defining your own EqualityComparer,
see <a href="http://blogs.msdn.com/bclteam/archive/2006/11/09/introducing-hashset-t-kim-hamilton.aspx" target="_blank">Introducing
HashSet&lt;T&gt; from Kim Hamilton</a> on the <a href="http://blogs.msdn.com/bclteam/default.aspx" target="_blank">BCL
Team Blog</a>.
</p>
        <p>
So, welcome the New Kid on the Block to the Generic Collections.  
</p>
        <p>
One last random link I had on the subject for those interested in LINQ: 
<br /><a href="http://msdn2.microsoft.com/en-us/library/bb397728.aspx" target="_blank">Good
side-by-side comparison of the HashSet and LINQ Set Operations</a></p>
        <img width="0" height="0" src="http://www.r2musings.com/aggbug.ashx?id=c5527d87-55c1-47fa-a349-bbd955d7c2be" />
      </body>
      <title>The New Generic Kid on the Block - HashSet&amp;lt;T&amp;gt;</title>
      <guid isPermaLink="false">http://www.r2musings.com/PermaLink,guid,c5527d87-55c1-47fa-a349-bbd955d7c2be.aspx</guid>
      <link>http://www.r2musings.com/2008/01/25/TheNewGenericKidOnTheBlockHashSetltTgt.aspx</link>
      <pubDate>Fri, 25 Jan 2008 07:53:51 GMT</pubDate>
      <description>&lt;p&gt;
In mathematics, a Set is typically thought of as a collection of &lt;strong&gt;distinct&lt;/strong&gt; objects
that is usually defined by some rule that determines whether they are a member of
that particular Set.&amp;nbsp; For example, a Set could be defined to contain "all the
odd numbers under 100" or "every number divisible by 2" or whatever.&amp;nbsp; The main
points here being that the objects in a Set are distinct (i.e. NO duplicate objects
are allowed) and the objects are not ordered or sorted in any way.&amp;nbsp; (If you really
feel the need to geek out on Set Theory, be my &lt;a href="http://en.wikipedia.org/wiki/Set" target=_blank&gt;guest&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
According to the &lt;a href="http://msdn2.microsoft.com/en-us/library/bb359438.aspx" target=_blank&gt;MSDN
Documentation for HashSet&lt;/a&gt;, "a set is a collection that contains no duplicate elements,
and whose elements are in no particular order."&amp;nbsp; Sound familiar?&amp;nbsp; In the
.NET Base Class Library, there has never been a true Set class until now with the
release of&amp;nbsp;.NET 3.5&amp;nbsp;and the brand-spanking-new System.Collections.Generic.HashSet&amp;lt;T&amp;gt;
class.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
In the past, when we needed to implement a Set in .NET, we sort of bastardized the
List&amp;lt;T&amp;gt; or other unsuspecting Collection classes into something like this:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
int[] intArray = new int[]{ 1, 2, 5, 7, 4, 1, 7, 9, 8}; 
&lt;br&gt;
List&amp;lt;int&amp;gt; intList = new List&amp;lt;int&amp;gt;(); 
&lt;br&gt;
foreach(int theInt in intArray) 
&lt;br&gt;
{ 
&lt;br&gt;
&amp;nbsp; // checking to make sure that the object is not in our List before adding 
&lt;br&gt;
&amp;nbsp; //&amp;nbsp; so we are calling Contains() and then Add() on every time through
the loop 
&lt;br&gt;
&amp;nbsp; if (!intList.Contains(theInt)) 
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; intList.Add(theInt); 
&lt;br&gt;
}
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
What we needed was a Set that would let us just keep adding objects to it and free
us from having to worry about it being there first.&amp;nbsp; A recent example of when
I really needed a true Set class was while working on the &lt;a href="http://silverlight.r2musings.com/weatherwidget" target=_blank&gt;Weather
Widget&lt;/a&gt;.&amp;nbsp; &lt;a href="http://www.weather.com" target=_blank&gt;The Weather Channel&lt;/a&gt; provides
some 40+ images for use in their SDK, yet in the Weather Widget I never need more
than maximum of 11 (and usually less as there is usually duplication).&amp;nbsp; So, I
had the idea to dynamically zip the images that I actually needed for a given Zip
Code and use that file for my image assets in Silverlight via CreateXamlFromDownloader.&amp;nbsp;
Obviously, I don't want these images duplicated in the zip file.&amp;nbsp; So, I came
up with this: 
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
HashSet&amp;lt;string&amp;gt; assets = new HashSet&amp;lt;string&amp;gt;(); 
&lt;br&gt;
foreach (ForecastDay day in forecast.Days) 
&lt;br&gt;
{ 
&lt;br&gt;
&amp;nbsp; // no Exception here if duplicate...it just doesn't add it. 
&lt;br&gt;
&amp;nbsp; assets.Add(Server.MapPath(String.Format("~/images/{0}", day.IconDay))); 
&lt;br&gt;
} 
&lt;br&gt;
Utility.WriteZipFile(assets.ToArray&amp;lt;string&amp;gt;()) 
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
This just scratches the surface of what HashSet&amp;lt;T&amp;gt; is capable of.&amp;nbsp; There
are member methods available for most Set operations, such as &lt;a href="http://msdn2.microsoft.com/en-us/library/bb293080.aspx"&gt;IntersectWith&lt;/a&gt;(), &lt;a href="http://msdn2.microsoft.com/en-us/library/bb342097.aspx"&gt;UnionWith&lt;/a&gt;(), &lt;a href="http://msdn2.microsoft.com/en-us/library/bb358446.aspx"&gt;IsSubsetOf&lt;/a&gt;(), &lt;a href="http://msdn2.microsoft.com/en-us/library/bb346923.aspx"&gt;IsSupersetOf&lt;/a&gt;(),
RemoveWhere(), etc.&amp;nbsp;&amp;nbsp; Here's a link to all of the &lt;a href="http://msdn2.microsoft.com/en-us/library/bb341004.aspx" target=_blank&gt;HashSet&amp;lt;T&amp;gt;
Members&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Recall that being a member of a set depends on &lt;em&gt;some rule&lt;/em&gt; that determines
this membership.&amp;nbsp; With the HashSet&amp;lt;T&amp;gt;, you can define your own rule of
what it means to be in a Set.&amp;nbsp; For a good example of defining your own EqualityComparer,
see &lt;a href="http://blogs.msdn.com/bclteam/archive/2006/11/09/introducing-hashset-t-kim-hamilton.aspx" target=_blank&gt;Introducing
HashSet&amp;lt;T&amp;gt; from Kim Hamilton&lt;/a&gt; on the &lt;a href="http://blogs.msdn.com/bclteam/default.aspx" target=_blank&gt;BCL
Team Blog&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
So, welcome the New Kid on the Block to the Generic Collections.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
One last random link I had on the subject for those interested in LINQ: 
&lt;br&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/bb397728.aspx" target=_blank&gt;Good
side-by-side comparison of the HashSet and LINQ Set Operations&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.r2musings.com/aggbug.ashx?id=c5527d87-55c1-47fa-a349-bbd955d7c2be" /&gt;</description>
      <comments>http://www.r2musings.com/CommentView,guid,c5527d87-55c1-47fa-a349-bbd955d7c2be.aspx</comments>
      <category>Generics</category>
    </item>
    <item>
      <trackback:ping>http://www.r2musings.com/Trackback.aspx?guid=65958793-e50f-478d-b888-252541188665</trackback:ping>
      <pingback:server>http://www.r2musings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.r2musings.com/PermaLink,guid,65958793-e50f-478d-b888-252541188665.aspx</pingback:target>
      <dc:creator>Rik Robinson</dc:creator>
      <wfw:comment>http://www.r2musings.com/CommentView,guid,65958793-e50f-478d-b888-252541188665.aspx</wfw:comment>
      <wfw:commentRss>http://www.r2musings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=65958793-e50f-478d-b888-252541188665</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Finally able to grab a minute to post my code and slides from the Introduction
to Generics presentation that I did this past weekend at the Alabama Code Camp at
the University of Alabama.  
</p>
        <p>
This is the abstract from the presentation:
</p>
        <p class="MsoNoSpacing" style="MARGIN: 0in 0in 0pt">
          <font color="#000000">With the release of the 2.0 version of the .NET Framework, Generics
became first class citizens </font>
        </p>
        <p class="MsoNoSpacing" style="MARGIN: 0in 0in 0pt">
          <font color="#000000">in the Common Language Runtime.<span style="mso-spacerun: yes">  </span>Yet,
many still shy away from using them because of perceived difficulty or other misconceptions.<span style="mso-spacerun: yes">  </span><span style="mso-spacerun: yes"> </span>This
presentation will seek to dispel a few of these myths and offer a gentle introduction
into using Generics on a daily basis.<span style="mso-spacerun: yes">  </span>Along
the way, I’ll also demonstrate language enhancements in the .NET 3.5 runtime that
lend themselves nicely to working with Generics.<span style="mso-spacerun: yes">  </span></font>
        </p>
        <p class="MsoNoSpacing" style="MARGIN: 0in 0in 0pt">
          <font color="#000000">
            <span style="mso-spacerun: yes">
            </span>
          </font> 
</p>
        <p class="MsoNoSpacing" style="MARGIN: 0in 0in 0pt">
          <font color="#000000">
            <span style="mso-spacerun: yes">Get the download <a href="http://www.r2musings.com/downloads/generics101.zip">here</a>.  </span>
          </font>
        </p>
        <p>
          <font color="#006400">Note:  The code is compiled on Visual Studio 2008 (Orcas)
Beta 2.  The only project in the solution that uses .NET 3.5 specific code is
the Collections project.  This uses C# 3.5 Automatic Properties and Property
Initializers.</font>  
</p>
        <img width="0" height="0" src="http://www.r2musings.com/aggbug.ashx?id=65958793-e50f-478d-b888-252541188665" />
      </body>
      <title>Time for T  :  An Introduction to .NET Generics</title>
      <guid isPermaLink="false">http://www.r2musings.com/PermaLink,guid,65958793-e50f-478d-b888-252541188665.aspx</guid>
      <link>http://www.r2musings.com/2007/10/08/TimeForTAnIntroductionToNETGenerics.aspx</link>
      <pubDate>Mon, 08 Oct 2007 18:24:56 GMT</pubDate>
      <description>&lt;p&gt;
Finally able to grab a minute to&amp;nbsp;post my&amp;nbsp;code and slides from the Introduction
to Generics presentation that I did this past weekend at the Alabama Code Camp at
the University of Alabama.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
This is the abstract from the presentation:
&lt;/p&gt;
&lt;p class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000&gt;With the release of the 2.0 version of the .NET Framework, Generics
became first class citizens &lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000&gt;in the Common Language Runtime.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Yet,
many still shy away from using them because of perceived difficulty or other misconceptions.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/span&gt;This
presentation will seek to dispel a few of these myths and offer a gentle introduction
into using Generics on a daily basis.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;Along
the way, I’ll also demonstrate language enhancements in the .NET 3.5 runtime that
lend themselves nicely to working with Generics.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;/span&gt;&lt;/font&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;
&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;Get the download &lt;a href="http://www.r2musings.com/downloads/generics101.zip"&gt;here&lt;/a&gt;.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font color=#006400&gt;Note:&amp;nbsp; The code is compiled on Visual Studio 2008 (Orcas)
Beta 2.&amp;nbsp; The only project in the solution that uses .NET 3.5 specific code is
the Collections project.&amp;nbsp; This uses C# 3.5 Automatic Properties and Property
Initializers.&lt;/font&gt;&amp;nbsp; 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.r2musings.com/aggbug.ashx?id=65958793-e50f-478d-b888-252541188665" /&gt;</description>
      <comments>http://www.r2musings.com/CommentView,guid,65958793-e50f-478d-b888-252541188665.aspx</comments>
      <category>Generics</category>
      <category>Presentations</category>
    </item>
    <item>
      <trackback:ping>http://www.r2musings.com/Trackback.aspx?guid=397a381d-7298-47db-9f2f-742f95f4f074</trackback:ping>
      <pingback:server>http://www.r2musings.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.r2musings.com/PermaLink,guid,397a381d-7298-47db-9f2f-742f95f4f074.aspx</pingback:target>
      <dc:creator>Rik Robinson</dc:creator>
      <wfw:comment>http://www.r2musings.com/CommentView,guid,397a381d-7298-47db-9f2f-742f95f4f074.aspx</wfw:comment>
      <wfw:commentRss>http://www.r2musings.com/SyndicationService.asmx/GetEntryCommentsRss?guid=397a381d-7298-47db-9f2f-742f95f4f074</wfw:commentRss>
      <title>Generic Methods: Find Controls by Type</title>
      <guid isPermaLink="false">http://www.r2musings.com/PermaLink,guid,397a381d-7298-47db-9f2f-742f95f4f074.aspx</guid>
      <link>http://www.r2musings.com/2007/10/08/GenericMethodsFindControlsByType.aspx</link>
      <pubDate>Mon, 08 Oct 2007 15:07:05 GMT</pubDate>
      <description>&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;Although
this was originally part of my recent Generics presentation, I have received several
requests to publish it separately.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;The
reason that I created this originally was that I found myself often-times wanting
a strongly-typed list of all the checkboxes / buttons / etc in my code-behind/beside
pages.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;There is the Page.FindControl(string
id), but that only allows you to get a control by id and it returns a Control.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;I
wanted something more specific, yet generic enough to use as a Utility.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;This
was screaming for Generic Methods, so below is what I came up with. 
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;I
use this constantly and hope that someone else gets some mileage out of it.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;If
you have improvements, please post them.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;For
example usage, download the full Generics presentation.&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: 'Verdana','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System.Collections.Generic;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System.Text;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System.Text.RegularExpressions;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System.Web.UI;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;using&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; System.Web.UI.WebControls;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;namespace&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; r2musings.Web.UI.WebControls&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;static&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;class&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Utility&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;#region&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; FindControlsByType&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Returns
a generic list of controls of a provided type starting at a 
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;a
provided base control (works recursively) 
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Example
Usage:&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;List&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;Button&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt; buttonList
= Utility.FindControlsByType&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;Button&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;(testPanel);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;This
would return a list of all Buttons contained anywhere within testPanel&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;typeparam
name="T"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;Type of control&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/typeparam&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param
name="parentControl"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;Base control to start search&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;static&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&lt;font color=#000000&gt;&amp;lt;T&amp;gt;
FindControlsByType&amp;lt;T&amp;gt;(&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Control&lt;/span&gt;&lt;font color=#000000&gt; parentControl) &lt;/font&gt;&lt;span style="COLOR: blue"&gt;where&lt;/span&gt;&lt;font color=#000000&gt; T:
System.Web.UI.&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Control&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;//
new up our return list&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&lt;font color=#000000&gt;&amp;lt;T&amp;gt;
returnList = &lt;/font&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&lt;font color=#000000&gt;&amp;lt;T&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;//
loop through all controls and call internal recursion to 
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;//&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;add
all controls of type T to the returnList&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;foreach&lt;/span&gt;&lt;font color=#000000&gt; (&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Control&lt;/span&gt;&lt;font color=#000000&gt; childControl &lt;/font&gt;&lt;span style="COLOR: blue"&gt;in&lt;/span&gt;&lt;font color=#000000&gt; parentControl.Controls)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;InternalFindControlsByType&amp;lt;T&amp;gt;(childControl,
returnList);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;//
return our List&amp;lt;T&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt;&lt;font color=#000000&gt; returnList;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;#endregion&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;#region&lt;/span&gt;&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt; Recursion
Method&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Should
NOT call this method directly&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;This
is for the internal recursion of FindControlsByType()&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;typeparam
name="T"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;Type of control&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/typeparam&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param
name="parentControl"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;Base control to start search&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; &lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param
name="returnList"&amp;gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;List to add Controls&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/param&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;private&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;static&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;void&lt;/span&gt;&lt;font color=#000000&gt; InternalFindControlsByType&amp;lt;T&amp;gt;(&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Control&lt;/span&gt;&lt;font color=#000000&gt; parentControl, &lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&lt;font color=#000000&gt;&amp;lt;T&amp;gt;
returnList) &lt;/font&gt;&lt;span style="COLOR: blue"&gt;where&lt;/span&gt;&lt;font color=#000000&gt; T: System.Web.UI.&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Control&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (returnList
== &lt;/font&gt;&lt;span style="COLOR: blue"&gt;null&lt;/span&gt;&lt;font color=#000000&gt;)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;throw&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: blue"&gt;new&lt;/span&gt;&lt;font color=#000000&gt; &lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;ArgumentNullException&lt;/span&gt;&lt;font color=#000000&gt;(&lt;/font&gt;&lt;span style="COLOR: #a31515"&gt;"Null
List passed to InternalFindControlsByType"&lt;/span&gt;&lt;font color=#000000&gt;);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;if&lt;/span&gt;&lt;font color=#000000&gt; (parentControl &lt;/font&gt;&lt;span style="COLOR: blue"&gt;is&lt;/span&gt;&lt;font color=#000000&gt; T)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;returnList.Add((T)
parentControl);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: blue"&gt;foreach&lt;/span&gt;&lt;font color=#000000&gt; (&lt;/font&gt;&lt;span style="COLOR: #2b91af"&gt;Control&lt;/span&gt;&lt;font color=#000000&gt; childControl &lt;/font&gt;&lt;span style="COLOR: blue"&gt;in&lt;/span&gt;&lt;font color=#000000&gt; parentControl.Controls)&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR: green"&gt;//
call this method recursively to get all child controls&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;InternalFindControlsByType(childControl,
returnList);&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="COLOR: blue; FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;#endregion&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;
&lt;span style="FONT-FAMILY: Consolas; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes"&gt;&lt;font color=#000000&gt;}&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.r2musings.com/aggbug.ashx?id=397a381d-7298-47db-9f2f-742f95f4f074" /&gt;</description>
      <comments>http://www.r2musings.com/CommentView,guid,397a381d-7298-47db-9f2f-742f95f4f074.aspx</comments>
      <category>Generics</category>
    </item>
  </channel>
</rss>