<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Performance Profiling Parse vs. TryParse vs. ConvertTo</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx</link><description>When programming in .Net you are presented with several different ways to extract a numerical value (I’m using an Int32 for my example) from a string. Recently I was looking at the differences between Parse, TryParse and ConvertTo. So I figured that I</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Performance Profiling Parse vs. TryParse vs. ConvertTo</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#505771</link><pubDate>Tue, 20 Dec 2005 07:31:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:505771</guid><dc:creator>deepIce2</dc:creator><description>Well a problem with tryparse is that it is sooo tedious to use - yolu have to do this:&lt;br&gt;&lt;br&gt;ret = Int32.TryParse(str, out intValue);&lt;br&gt;&lt;br&gt;                     if (ret)&lt;br&gt;&lt;br&gt;                     {&lt;br&gt;&lt;br&gt;                                  intList.Add(intValue);&lt;br&gt;&lt;br&gt;                     }&lt;br&gt;&lt;br&gt;instead of this:&lt;br&gt;&lt;br&gt;intValue = Int32.Parse(str);&lt;br&gt;&lt;br&gt;intList.Add(intValue)</description></item><item><title>re: Performance Profiling Parse vs. TryParse vs. ConvertTo</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#505900</link><pubDate>Tue, 20 Dec 2005 18:18:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:505900</guid><dc:creator>Wedgebert</dc:creator><description>You're kind of comparing apples to oranges there.  You're doing error checking for TryParse but not for Parse.&lt;br&gt;&lt;br&gt;In reality it would be&lt;br&gt;&lt;br&gt;Try&lt;br&gt;  intValue = Int32.Parse(str)&lt;br&gt;  intList.Add(intValue)&lt;br&gt;Catch Ex As FormatException&lt;br&gt;  ' Error Handling&lt;br&gt;End Try&lt;br&gt;&lt;br&gt;vs&lt;br&gt;&lt;br&gt;If Int32.TryParse(str, intValue) Then&lt;br&gt;  intList.Add(intValue)&lt;br&gt;Else&lt;br&gt;  ' Error Handling&lt;br&gt;End If</description></item><item><title>re: Performance Profiling Parse vs. TryParse vs. ConvertTo</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#506704</link><pubDate>Thu, 22 Dec 2005 16:11:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:506704</guid><dc:creator>Fredrik</dc:creator><description>deepIce2, well you didn't include a try/catch around your Int32.Parse example - if you had, TryParse would be less lines of code ;) And also, instead of :&lt;br&gt;&lt;br&gt;ret = Int32.TryParse(str, out intValue);&lt;br&gt;if (ret)&lt;br&gt;{&lt;br&gt;   intList.Add(intValue);&lt;br&gt;} &lt;br&gt;&lt;br&gt;&lt;br&gt;why not just do&lt;br&gt;&lt;br&gt;if(Int32.TryParse(str, out intValue);&lt;br&gt;{&lt;br&gt;  intList.Add(intValue);&lt;br&gt;}&lt;br&gt;&lt;br&gt;Personally I love TryParse - it's more efficient and faster to work with :)</description></item><item><title>re: Performance Profiling Parse vs. TryParse vs. ConvertTo</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#506904</link><pubDate>Fri, 23 Dec 2005 01:10:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:506904</guid><dc:creator>ianhu</dc:creator><description>A couple of folks have accused me of comparing apples to oranges, and I must admit that they have me nailed. I *was* comparing apples to oranges, but I was also doing it on purpose ;-). I was just showing how much time you do save by doing your own basic error checking with TryParse as opposed to just catching the exceptions thrown by Parse. </description></item><item><title>The Profiling Team’s Greatest Hits: Volume Two</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#544756</link><pubDate>Mon, 06 Mar 2006 23:46:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:544756</guid><dc:creator>IanWho's bLog</dc:creator><description>The profiler team has been crazy busy with getting Visual Studio Team System shipped and out the door,...</description></item><item><title>TryParse contre Parse, ou pourquoi &amp;amp;#233;viter les exceptions &amp;amp;quot;inutiles&amp;amp;quot;</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#624370</link><pubDate>Sat, 10 Jun 2006 00:26:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:624370</guid><dc:creator>CoqBlog</dc:creator><description>En .Net 1.1, vous vous &amp;amp;#234;tes peut &amp;amp;#234;tre d&amp;amp;#233;j&amp;amp;#224; servi de la m&amp;amp;#233;thode TryParse du type Double.En .Net 2.0,&amp;amp;amp;nbsp;plusieurs...</description></item><item><title>Zoom ASP.net  &amp;raquo; Blog Archive   &amp;raquo; Diffrence Between Parse vs. TryParse vs. ConvertTo</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#4065488</link><pubDate>Thu, 26 Jul 2007 16:39:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4065488</guid><dc:creator>Zoom ASP.net  » Blog Archive   » Diffrence Between Parse vs. TryParse vs. ConvertTo</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blog.zoomasp.net/?p=18"&gt;http://blog.zoomasp.net/?p=18&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>TryParse() method in .NET 2.0</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#5247205</link><pubDate>Tue, 02 Oct 2007 23:25:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5247205</guid><dc:creator>Hosam Kamel</dc:creator><description>&lt;p&gt;TryParse method is exposed by several classes in the System namespace System.Boolean.TryParse(System&lt;/p&gt;
</description></item><item><title>Data Division ?? Performance von Parse, TryParse und ConvertTo</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#7014648</link><pubDate>Mon, 07 Jan 2008 13:45:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7014648</guid><dc:creator>Data Division ?? Performance von Parse, TryParse und ConvertTo</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://data-division.global-destruction.de/?p=112"&gt;http://data-division.global-destruction.de/?p=112&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Gading Retak  &amp;raquo; Blog Archive   &amp;raquo; Parsing string ke integer di C#</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#7837218</link><pubDate>Thu, 21 Feb 2008 16:24:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7837218</guid><dc:creator>Gading Retak  » Blog Archive   » Parsing string ke integer di C#</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://gadingretak.com/blog/?p=13"&gt;http://gadingretak.com/blog/?p=13&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>RealTime project coding standards &amp;laquo; Sailajamehra&amp;#8217;s Blog</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#9158099</link><pubDate>Sun, 30 Nov 2008 16:25:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9158099</guid><dc:creator>RealTime project coding standards &amp;laquo; Sailajamehra&amp;#8217;s Blog</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://sailjamehra.wordpress.com/2008/11/30/realtime-project-coding-standards/"&gt;http://sailjamehra.wordpress.com/2008/11/30/realtime-project-coding-standards/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Real time Project coding Standards &amp;laquo; Sailajamehra&amp;#8217;s Blog</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#9181251</link><pubDate>Sat, 06 Dec 2008 16:59:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9181251</guid><dc:creator>Real time Project coding Standards &amp;laquo; Sailajamehra&amp;#8217;s Blog</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://sailjamehra.wordpress.com/2008/12/06/real-time-project-coding-standards/"&gt;http://sailjamehra.wordpress.com/2008/12/06/real-time-project-coding-standards/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Coding Standards and Best Practices &amp;laquo; Ravi Varma Thumati</title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#9190544</link><pubDate>Wed, 10 Dec 2008 14:03:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9190544</guid><dc:creator>Coding Standards and Best Practices &amp;laquo; Ravi Varma Thumati</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://thumatiravivarma.wordpress.com/2008/12/10/coding-standards-and-best-practices/"&gt;http://thumatiravivarma.wordpress.com/2008/12/10/coding-standards-and-best-practices/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Best Practices for C# &amp;laquo; </title><link>http://blogs.msdn.com/ianhu/archive/2005/12/19/505702.aspx#9372907</link><pubDate>Fri, 23 Jan 2009 20:28:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9372907</guid><dc:creator>Best Practices for C# &amp;laquo; </dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://rthumati.wordpress.com/2009/01/23/best-practices-for-c/"&gt;http://rthumati.wordpress.com/2009/01/23/best-practices-for-c/&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>