Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics (Retired) Perfect "try" Code and "catch" Exceptions

Ranvir Sahota
Ranvir Sahota
9,844 Points

Why use try/catch instead of TryParse?

The question is in the title why did Jeremy use try/catch instead of TryParse? Did he do it to just introduce exceptions and how to handle them?

1 Answer

Steven Parker
Steven Parker
231,248 Points

I think you have the right idea.

I believe the point of the lesson is to introduce exceptions and handling them. Perhaps the particular example shown could also be coded using TryParse, but there will be many other cases where that cannot be used but exceptions can still be handled.