<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" 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:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>.NET Tips</title>
        <link>http://www.wtfnext.com/category/9085.aspx</link>
        <description>bite-size morsels of programming goodness</description>
        <language>en-US</language>
        <copyright>Stacy Vicknair</copyright>
        <managingEditor>svickn@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>How necessary is CLS compliance?</title>
            <link>http://wtfnext.com/archive/2009/08/19/how-necessary-is-cls-compliance.aspx</link>
            <description>&lt;p&gt;The answer, as with so many other questions in the coding world, is that it depends. However, for the average developer CLS compliance is not a concern. For the specialized component or tool developer CLS compliance &lt;a href="http://www.agileprogrammer.com/dotnetguy/archive/2003/04/25/4540.aspx"&gt;might be your bread and butter winner&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;For the average developer, CLS compliance is nothing more than bragging rights or an enforced rule at your organization. You probably only operate in one language provided graciously from MSFT and have little concern if your libraries will play nicely with the other languages. The benefits of CLS compliance are &lt;strong&gt;&lt;em&gt;nullified&lt;/em&gt;&lt;/strong&gt; if you do not work in a multi language environment.&lt;/p&gt;  &lt;p&gt;For those who do work in a multilingual (I’m talking programming here) environment then CLS compliance is &lt;a href="http://msdn.microsoft.com/en-us/library/730f1wy3.aspx"&gt;a step towards less problems&lt;/a&gt;. Typically this will affect those who produce frameworks and tools intended to be used by other systems. This could also affect you if you are extending a preexisting system produced in a different language.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;h2&gt;How can you take steps toward CLS Compliance?&lt;/h2&gt;  &lt;p&gt;The first step is to mark you assemblies as CLS Compliant. This can be done by specifying the &lt;a href="http://msdn.microsoft.com/en-us/library/system.clscompliantattribute.aspx"&gt;CLSCompliantAttribute&lt;/a&gt;. If you are in C#, the compiler will warn about problems with compliance. If in VB.NET, the compiler will not warn you, but that is supposed to change in the future (When? I’m not sure.)&lt;/p&gt;  &lt;p&gt;To take a proactive approach to CLS compliance, &lt;a href="http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx"&gt;you can take a look over the CLS&lt;/a&gt; and adhere to the rules that it specifies.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:87779ae9-f6ee-461b-9d4b-b458768283d9" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/CLS+compliance" rel="tag"&gt;CLS compliance&lt;/a&gt;,&lt;a href="http://technorati.com/tags/CLSCompliantAttribute" rel="tag"&gt;CLSCompliantAttribute&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134192"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134192" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/134192.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/08/19/how-necessary-is-cls-compliance.aspx</guid>
            <pubDate>Wed, 19 Aug 2009 16:46:23 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/134192.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/08/19/how-necessary-is-cls-compliance.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/134192.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/134192.aspx</trackback:ping>
        </item>
        <item>
            <title>.NET Tip: Using String Constructors</title>
            <link>http://wtfnext.com/archive/2009/05/04/.net-tip-using-string-constructors.aspx</link>
            <description>&lt;p&gt;When we use string so often for its value-like behavior, it is easy to forget that the String class comes with its own constructors, and that there are some tasks you can achieve with the string constructor that you might have overlooked otherwise.&lt;/p&gt;  &lt;h1&gt;Repeating characters&lt;/h1&gt;  &lt;p&gt;One of the more useful overrides of the String constructor is the ability to easily repeat any character a number of times. Here’s a brief example:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;horizontalRule &lt;span style="color: blue"&gt;As New String&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"-"c&lt;/span&gt;, 100)
Console.WriteLine(horizontalRule)&lt;/pre&gt;

&lt;h1&gt;Subsections of Char arrays&lt;/h1&gt;

&lt;p&gt;If you’ve got a Char array you can grab a subsection by specifying a start point and a length:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;catchyPhrase &lt;span style="color: blue"&gt;As Char&lt;/span&gt;() = &lt;span style="color: blue"&gt;CType&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"Catch for us the foxes."&lt;/span&gt;, &lt;span style="color: blue"&gt;Char&lt;/span&gt;())
&lt;span style="color: blue"&gt;Dim &lt;/span&gt;phrasePart &lt;span style="color: blue"&gt;As New String&lt;/span&gt;(catchyPhrase, 0, 12)

Console.WriteLine(phrasePart)&lt;/pre&gt;

&lt;h1&gt;Other pointer based operations&lt;/h1&gt;

&lt;p&gt;There are a few more useful constructors if you are developing in C# or C++ that make use of arrays, but because Visual Basic doesn’t allow for the use of unsafe types I won’t go over them. You can check out the remaining constructors on the MSDN at the link below.&lt;/p&gt;

&lt;p&gt;There are many useful features in .NET that can be easily overlooked, but in the long run you might find something that would have otherwise saved you time.&lt;/p&gt;

&lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/system.string.string.aspx" href="http://msdn.microsoft.com/en-us/library/system.string.string.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.string.string.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:d96494a0-1f21-47c6-a8a5-eb5077c317f7" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/VB.NET" rel="tag"&gt;VB.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/String" rel="tag"&gt;String&lt;/a&gt;,&lt;a href="http://technorati.com/tags/MSDN" rel="tag"&gt;MSDN&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131719"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131719" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/131719.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2009/05/04/.net-tip-using-string-constructors.aspx</guid>
            <pubDate>Mon, 04 May 2009 14:31:37 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/131719.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2009/05/04/.net-tip-using-string-constructors.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/131719.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/131719.aspx</trackback:ping>
        </item>
        <item>
            <title>.NET Tip: Regular expression &amp;quot;/d&amp;quot; is more than just 0-9</title>
            <link>http://wtfnext.com/archive/2008/12/30/.net-tip-regular-expression-quotdquot-is-more-than-just-0-9.aspx</link>
            <description>&lt;p&gt;In Java, this is not the case as far as I know. However, when working with regular expressions in .NET, be weary of just slapping &lt;strong&gt;/d&lt;/strong&gt; in when you need a number alone. Just like &lt;strong&gt;&lt;/strong&gt;&lt;a href="http://www.wtfnext.com/archive/2008/12/30/.net-tip-char.isdigit-revisited.aspx"&gt;Char.IsDigit isn't just numbers&lt;/a&gt;, &lt;strong&gt;/d&lt;/strong&gt; follows suit.&lt;/p&gt;  &lt;p&gt;The reason is that /d and Char.IsDigit are both validating against the Unicode designation "Nd". This stands for number decimal digit, but does not limit itself to just 0-9.&lt;/p&gt;  &lt;p&gt;If you're using regular expressions to begin with, you probably already realize that it is fairly easy to correct this. All it takes is to use &lt;strong&gt;[0-9]&lt;/strong&gt; instead of &lt;strong&gt;/d&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:aa619e62-0014-4ec0-841c-ae2c3fdfab07" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Regular%20Expressions" rel="tag"&gt;Regular Expressions&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.NET%20Tips" rel="tag"&gt;.NET Tips&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128252"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128252" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/128252.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/12/30/.net-tip-regular-expression-quotdquot-is-more-than-just-0-9.aspx</guid>
            <pubDate>Wed, 31 Dec 2008 02:38:17 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/128252.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/12/30/.net-tip-regular-expression-quotdquot-is-more-than-just-0-9.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/128252.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/128252.aspx</trackback:ping>
        </item>
        <item>
            <title>.NET Tip: Char.IsDigit revisited</title>
            <link>http://wtfnext.com/archive/2008/12/30/.net-tip-char.isdigit-revisited.aspx</link>
            <description>&lt;p&gt;In a &lt;a href="http://www.wtfnext.com/archive/2008/12/09/.net-tip-when-to-use-char.isdigit-versus-char.isnumber.aspx"&gt;previous .NET Tip&lt;/a&gt;, I compared &lt;strong&gt;IsDigit&lt;/strong&gt; to &lt;strong&gt;IsNumber&lt;/strong&gt; for parsing numbers from a string. I wanted to point out that it is true that &lt;strong&gt;Char.IsDigit&lt;/strong&gt; does only get decimal digits, but to further elaborate that this isn't just 0 through 9.&lt;/p&gt;  &lt;p&gt;Sure, 0 through 9 are the decimal digits that most of us would consider &lt;strong&gt;the only ones&lt;/strong&gt;. However, with the globalization being a major push for .NET, we've got to think outside of our local scope. &lt;strong&gt;Char.IsDigit will also pick up other culture specific decimal digits&lt;/strong&gt;. What this means is that other languages, such as Arabic, will have their own representations of digits, and those are also accepted within &lt;strong&gt;Char.IsDigit&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;So, if you are looking to use &lt;strong&gt;IsDigit&lt;/strong&gt;, be certain you are using it properly. Otherwise, you might be better off with regular expressions. However, be warned, even regular expressions aren't immune to this issue.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b04cf576-685b-4707-b756-b9d741386253" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Char.IsDigit" rel="tag"&gt;Char.IsDigit&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128251"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128251" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/128251.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/12/30/.net-tip-char.isdigit-revisited.aspx</guid>
            <pubDate>Tue, 30 Dec 2008 20:32:27 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/128251.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/12/30/.net-tip-char.isdigit-revisited.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/128251.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/128251.aspx</trackback:ping>
        </item>
        <item>
            <title>.NET Tip: Match.Groups starts at 1 not 0</title>
            <link>http://wtfnext.com/archive/2008/12/15/.net-tip-match.groups-starts-at-1-not-0.aspx</link>
            <description>&lt;p&gt;I'm currently studying for my first Microsoft certification exam, the 070-536, and during the process I came across this small quirk. Although most object arrays or collections in VB.NET start at 0, the &lt;strong&gt;Match.Groups &lt;/strong&gt;collection starts at &lt;strong&gt;1&lt;/strong&gt;. This could potentially be a small frustration for those who don't use regex that often (especially with the added need to extract the information instead of just validating it).&lt;/p&gt;  &lt;p&gt;So, if you are extracting information using regex in the future, keep in mind your index starts at 1 for Match.Groups. If possible, avoid the index by using for-each enumeration. Here's an illustration of the point from the MSDN article on Match.Groups, importing the &lt;strong&gt;System.Text.RegularExpressions&lt;/strong&gt; namespace:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;text &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;"One car red car blue car"
&lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;pattern &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #a31515"&gt;"(\w+)\s+(car)"

&lt;/span&gt;&lt;span style="color: green"&gt;' Instantiate the regular expression object.
&lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;r &lt;span style="color: blue"&gt;As &lt;/span&gt;Regex = &lt;span style="color: blue"&gt;New &lt;/span&gt;Regex(pattern, RegexOptions.IgnoreCase)

&lt;span style="color: green"&gt;' Match the regular expression pattern against a text string.
&lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;m &lt;span style="color: blue"&gt;As &lt;/span&gt;Match = r.Match(text)
&lt;span style="color: blue"&gt;Dim &lt;/span&gt;matchcount &lt;span style="color: blue"&gt;As Integer &lt;/span&gt;= 0
&lt;span style="color: blue"&gt;Do While &lt;/span&gt;m.Success
    matchcount += 1
    Console.WriteLine(&lt;span style="color: #a31515"&gt;"Match" &lt;/span&gt;&amp;amp; (matchcount))
    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;i &lt;span style="color: blue"&gt;As Integer
    For &lt;/span&gt;i = 1 &lt;span style="color: blue"&gt;To &lt;/span&gt;2
        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;g &lt;span style="color: blue"&gt;As &lt;/span&gt;Group = m.Groups(i)
        Console.WriteLine(&lt;span style="color: #a31515"&gt;"Group" &lt;/span&gt;&amp;amp; i &amp;amp; &lt;span style="color: #a31515"&gt;"='" &lt;/span&gt;&amp;amp; g.ToString() &amp;amp; &lt;span style="color: #a31515"&gt;"'"&lt;/span&gt;)
        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;cc &lt;span style="color: blue"&gt;As &lt;/span&gt;CaptureCollection = g.Captures
        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;j &lt;span style="color: blue"&gt;As Integer
        For &lt;/span&gt;j = 0 &lt;span style="color: blue"&gt;To &lt;/span&gt;cc.Count - 1
            &lt;span style="color: blue"&gt;Dim &lt;/span&gt;c &lt;span style="color: blue"&gt;As &lt;/span&gt;Capture = cc(j)
            Console.WriteLine(&lt;span style="color: #a31515"&gt;"Capture" &lt;/span&gt;&amp;amp; j &amp;amp; &lt;span style="color: #a31515"&gt;"='" &lt;/span&gt;&amp;amp; c.ToString() _
               &amp;amp; &lt;span style="color: #a31515"&gt;"', Position=" &lt;/span&gt;&amp;amp; c.Index)
        &lt;span style="color: blue"&gt;Next
    Next
    &lt;/span&gt;m = m.NextMatch()
&lt;span style="color: blue"&gt;Loop&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;It is very subtle and hardly even mentioned in the MSDN article, but you'll see above that the For loop initializes i as 1, not 0.&lt;/p&gt;

&lt;p&gt;&lt;a title="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.match.groups.aspx" href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.match.groups.aspx"&gt;http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.match.groups.aspx&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:29b65e2b-ef49-46db-9a78-ec24e6b20418" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/.NET%20Tips" rel="tag"&gt;.NET Tips&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Match.Groups" rel="tag"&gt;Match.Groups&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127916"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127916" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/127916.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/12/15/.net-tip-match.groups-starts-at-1-not-0.aspx</guid>
            <pubDate>Mon, 15 Dec 2008 19:37:55 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/127916.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/12/15/.net-tip-match.groups-starts-at-1-not-0.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/127916.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/127916.aspx</trackback:ping>
        </item>
        <item>
            <title>.NET Tip: When to use Char.IsDigit versus Char.IsNumber</title>
            <link>http://wtfnext.com/archive/2008/12/09/.net-tip-when-to-use-char.isdigit-versus-char.isnumber.aspx</link>
            <description>&lt;p&gt;&lt;strong&gt;Char.IsDigit&lt;/strong&gt; and &lt;strong&gt;Char.IsNumber&lt;/strong&gt; are both methods within the System namespace. The methods themselves are almost confusing in name at first glance. You might think that they do the same thing, but then &lt;strong&gt;&lt;em&gt;why have both?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Well, because they don't do the same thing. &lt;strong&gt;IsDigit&lt;/strong&gt; refers to only the decimal digits whereas &lt;strong&gt;IsNumber&lt;/strong&gt; can refer to anything in the numeric Unicode category. So, if you just want decimal, stick with &lt;strong&gt;IsDigit&lt;/strong&gt;. Otherwise, you'll be getting a lot more than you bargained for if cleaning data this way.&lt;/p&gt;  &lt;p&gt;I'll leave you with a quick example of &lt;strong&gt;IsDigit&lt;/strong&gt; in use for string cleaning:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Private Function &lt;/span&gt;StripNonDigitData(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;input &lt;span style="color: blue"&gt;As String&lt;/span&gt;) &lt;span style="color: blue"&gt;As String
    Dim &lt;/span&gt;output &lt;span style="color: blue"&gt;As New &lt;/span&gt;StringBuilder("")
    &lt;span style="color: blue"&gt;For Each &lt;/span&gt;c &lt;span style="color: blue"&gt;As Char In &lt;/span&gt;input
        &lt;span style="color: blue"&gt;If Char&lt;/span&gt;.IsDigit(c) &lt;span style="color: blue"&gt;Then
            &lt;/span&gt;output.Append(c)
        &lt;span style="color: blue"&gt;End If
    Next
    Return &lt;/span&gt;output.ToString
&lt;span style="color: blue"&gt;End Function&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;P.S. &lt;/strong&gt;Stay tuned, I'm working on a quick series to bring threading back down to a mere mortal level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;EDIT:&lt;/em&gt;&lt;/strong&gt; I've revisited this article to shed more light on IsDigit, &lt;a href="http://www.wtfnext.com/archive/2008/12/30/.net-tip-char.isdigit-revisited.aspx"&gt;read on to prevent any more mistakes!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b7dc2584-dc98-41b9-829b-7bff5ce507be" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/IsDigit" rel="tag"&gt;IsDigit&lt;/a&gt;,&lt;a href="http://technorati.com/tags/IsNumber" rel="tag"&gt;IsNumber&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.NET%20Tips" rel="tag"&gt;.NET Tips&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127770"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127770" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/127770.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/12/09/.net-tip-when-to-use-char.isdigit-versus-char.isnumber.aspx</guid>
            <pubDate>Tue, 09 Dec 2008 21:15:49 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/127770.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/12/09/.net-tip-when-to-use-char.isdigit-versus-char.isnumber.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/127770.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/127770.aspx</trackback:ping>
        </item>
        <item>
            <title>.NET Tip: Getting information from DataTable.DefaultView using RowFilter</title>
            <link>http://wtfnext.com/archive/2008/12/02/.net-tip-getting-information-from-datatable.defaultview-using-rowfilter.aspx</link>
            <description>&lt;p&gt;So it may make sense to you how to fetch information from a DefaultView using RowFilter by binding the view, but what about when you just need to extract a value?&lt;/p&gt;  &lt;p&gt;After applying a RowFilter, the first inclination might be to use the DefaultView.Table.Rows to get information that is filtered. Well, that is ultimately wrong. The DefaultView.Table returns the table the view had originated from. The table you get does not have the RowFilter restrictions applied, and therefore returns the whole table. Instead, use the DefaultView.Item(&lt;em&gt;index&lt;/em&gt;).Item(&lt;em&gt;columnname&lt;/em&gt;) to get the value that really comes from the filtered results. Here's a small snippet to illustrate DefaultView's use as mentioned above:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Public Function &lt;/span&gt;GetRate(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;id &lt;span style="color: blue"&gt;As Integer&lt;/span&gt;, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;suffix &lt;span style="color: blue"&gt;As Integer&lt;/span&gt;) &lt;span style="color: blue"&gt;As Double
    &lt;/span&gt;&lt;span style="color: green"&gt;'fetch rate
    &lt;/span&gt;&lt;span style="color: blue"&gt;With &lt;/span&gt;m_rates.Tables(&lt;span style="color: #a31515"&gt;"rates"&lt;/span&gt;).DefaultView
        &lt;span style="color: green"&gt;'if there are results set rate to the value else 0.0
        &lt;/span&gt;.RowFilter = &lt;span style="color: #a31515"&gt;"acn = '" &lt;/span&gt;&amp;amp; id.ToString(CultureInfo.InvariantCulture) &amp;amp; &lt;span style="color: #a31515"&gt;"' and sh_sfx = '" &lt;/span&gt;&amp;amp; suffix.ToString(CultureInfo.InvariantCulture) &amp;amp; &lt;span style="color: #a31515"&gt;"'"
        &lt;/span&gt;&lt;span style="color: blue"&gt;If &lt;/span&gt;.Count &amp;gt; 0 &lt;span style="color: blue"&gt;Then
            Return &lt;/span&gt;.Item(0).Item(&lt;span style="color: #a31515"&gt;"est_interest_rate"&lt;/span&gt;)
        &lt;span style="color: blue"&gt;Else
            Return &lt;/span&gt;0.0
        &lt;span style="color: blue"&gt;End If
    End With
End Function&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Again, any comments are welcome on this snippet of code.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8bcb4e6b-f974-4afc-8641-99c28dd2742c" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/DefaultView" rel="tag"&gt;DefaultView&lt;/a&gt;,&lt;a href="http://technorati.com/tags/VB.NET" rel="tag"&gt;VB.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/.NET%20Tips" rel="tag"&gt;.NET Tips&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127527"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127527" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/127527.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/12/02/.net-tip-getting-information-from-datatable.defaultview-using-rowfilter.aspx</guid>
            <pubDate>Tue, 02 Dec 2008 18:38:58 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/127527.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/12/02/.net-tip-getting-information-from-datatable.defaultview-using-rowfilter.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/127527.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/127527.aspx</trackback:ping>
        </item>
        <item>
            <title>.NET Tip: authorization forms credentials default is SHA1, not Clear</title>
            <link>http://wtfnext.com/archive/2008/11/21/.net-tip-authorization-forms-credentials-default-is-sha1-not-clear.aspx</link>
            <description>&lt;p&gt;I was recently following along in a quick tutorial in &lt;a href="http://www.amazon.com/Microsoft-ASP-NET-Programming-Visual-Version/dp/0735619344"&gt;Microsoft ASP.NET Programming with Microsoft Visual Basic .NET Version 2003 Step By Step&lt;/a&gt; by G. Andrew Duthie, when low and behold I came across a fundamental tutorial about ASP.NET authentication that just didn't work. The culprit? &lt;a href="http://msdn.microsoft.com/en-us/library/e01fc50a.aspx"&gt;authorization forms credentials has a default of SHA1&lt;/a&gt;, not Clear that the book assumed. I checked through the MSDN entries to make sure this still applied in 3.5, even though the book was written for ASP.NET 1.1 (which we use here, sadly).&lt;/p&gt;  &lt;p&gt;So, the book had requested that I enter the following in my web.config for an example:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;credentials&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;user &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;="1234" &lt;/span&gt;&lt;span style="color: red"&gt;password&lt;/span&gt;&lt;span style="color: blue"&gt;="pass" /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;credentials&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;    &lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;When I really should have been entering in this:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;credentials &lt;/span&gt;&lt;span style="color: red"&gt;passwordFormat&lt;/span&gt;&lt;span style="color: blue"&gt;="Clear"&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;user &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;="1234" &lt;/span&gt;&lt;span style="color: red"&gt;password&lt;/span&gt;&lt;span style="color: blue"&gt;="pass" /&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;credentials&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;    &lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;The result? frustration when my very straightforward and simple attempt at the ASP.NET world was foiled. So, in the case where you might use authentication this way (which is only for the most basic needs for "security") remember the default is SHA1, not Clear.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:726d5067-4fa2-469b-97d0-c0faf57ac595" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/.net%20tip" rel="tag"&gt;.net tip&lt;/a&gt;,&lt;a href="http://technorati.com/tags/authorization%20forms%20credentials" rel="tag"&gt;authorization forms credentials&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ASP.NET" rel="tag"&gt;ASP.NET&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127288"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=127288" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://wtfnext.com/aggbug/127288.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Stacy Vicknair</dc:creator>
            <guid>http://wtfnext.com/archive/2008/11/21/.net-tip-authorization-forms-credentials-default-is-sha1-not-clear.aspx</guid>
            <pubDate>Fri, 21 Nov 2008 21:25:48 GMT</pubDate>
            <wfw:comment>http://wtfnext.com/comments/127288.aspx</wfw:comment>
            <comments>http://wtfnext.com/archive/2008/11/21/.net-tip-authorization-forms-credentials-default-is-sha1-not-clear.aspx#feedback</comments>
            <wfw:commentRss>http://wtfnext.com/comments/commentRss/127288.aspx</wfw:commentRss>
            <trackback:ping>http://wtfnext.com/services/trackbacks/127288.aspx</trackback:ping>
        </item>
    </channel>
</rss>