[Mono-bugs] [Bug 471912] Prefer TryParse over Parse

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 21 19:39:58 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=471912

http://bugzilla.novell.com/show_bug.cgi?id=471912#c1


Sebastien Pouliot <spouliot at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spouliot at novell.com

--- Comment #1 from Sebastien Pouliot <spouliot at novell.com> 2010-01-22 00:39:56 UTC ---
How about this:

Look for methods that calls "<type> <type>.Parse(string s)"
and warn if "bool TryParse(string s, out <type>)" exists - maybe with an higher
severity if the code is not inside a try/[catch|finally] block.

That way it won't be limited to the BCL types (a moving target with 4.0 coming
up).

Another (design this time) rule could be to implement TryParse alternative when
a Parse method is found.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list