Parse vs. TryParse Application Sample
This sample demonstrates the performance benefits of using the TryParse method, exposed by several classes in thenamespace, in comparison to that type's Parse method.
For information about using the samples, see the following topics:
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. For information about required settings and the SDK Command Prompt, see.
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.