Click here to Skip to main content
15,884,298 members
Articles / Programming Languages / C#

Parsing Strings to Boolean

Rate me:
Please Sign up or sign in to vote.
5.00/5 (5 votes)
16 Sep 2010CPOL 22.3K   3  
If you don't need to check for other strings than True or False, then, you should use Boolean.Parse or Boolean.TryParse.// Return trueBoolean.Parse("true");// Return falseBoolean.Parse("false");// Exception.. you can prevent that from happening by using a try..catch// or using...
No downloads associated with this content

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer CGI
Canada Canada
I have a three years technical education in computer science (June 2006) and a four years bachelor's degree in Software Engineering from the École de Technologie Supérieure (August 2010). I worked as a Web Developper at the beginning of my career before being recruited as a .NET Analyst-Programer at SNC-Lavalin in Montreal. I worked there until they outsourced all development to CGI. I worked there since.

Comments and Discussions