Kick Off the Blog with a TryParse sample!


Well, I though I would kick off the BCL blog with a sample of TryParse. TryParse methods have been added to all the base datatypes in Whidbey (previously, TryParse was only available on the Double type). The TryParse demo is available on the new BCL website. The demo allows you to compare the speed of Parse on certain types, to TryParse, and clearly demonstrates why you should prefer TryParse!

Comments (7)

  1. Anonymous says:

    I am very happy to see this being addressed!

  2. Anonymous says:

    Thanks Frank!

  3. Anonymous says:

    Hey Kit, if I wanted to categorize parse and tryparse, are they from the Microsoft.Jscript.IParseText interface?

  4. Anonymous says:

    I guess TryParse is a Whidbey feature, in .net 1.1, this works:

    Regex.IsMatch(datapointer, @"^[-+]?[0-9]d.?[0]$")