Parse vs. TryParse Application Sample
This sample demonstrates the performance benefits of using the TryParse method, exposed by several classes in the System namespace, in comparison to that type's Parse method.
For information about using the samples, see How to: View and Download Samples.
To build the sample using the Command Prompt
Open a Command Prompt window and navigate to one of the language-specific subdirectories under the TryParse directory. (Make sure that the Path environment variable includes the path to the MSBuild.exe executable.)
Type msbuild TryParseDemoCS.sln or msbuild TryParseDemoVB.sln, depending on your choice of programming language, at the command line.
To build the sample using Visual Studio
Open Windows Explorer and navigate to one of the language-specific subdirectories under the TryParse directory.
Double-click the icon for the TryParseDemoCS.sln or TryParseDemoVB.sln file, depending on your choice of programming language, to open the file in Visual Studio 2005.
On the Build menu, click Build Solution.
The application will be built in the default \bin or \bin\Debug directory.
To run the sample
Navigate to the directory that contains the new executable, using the command prompt or Windows Explorer.
Type TryParseDemo.exe at the command line, or double-click the icon for TryParseDemo.exe to run it from Windows Explorer.