Click here to Skip to main content
15,900,816 members

Survey Results

"out" parameters: A good idea or a bad idea?

Survey period: 15 Jan 2018 to 22 Jan 2018

Given that it has its own Code Analysis warning we know where some people stand on this.

OptionVotes% 
They are a Good Thing1029.66
They are fine if used wisely43240.91
They are what they are15414.58
They should probably be avoided where possible20119.03
They should never be used. Ever.393.69
I have no idea.12812.12



 
GeneralRe: C# TryParse() Pin
obermd16-Jan-18 4:42
obermd16-Jan-18 4:42 
GeneralRe: C# TryParse() Pin
Richard Deeming16-Jan-18 3:35
mveRichard Deeming16-Jan-18 3:35 
GeneralRe: C# TryParse() Pin
Paulo Zemek17-Jan-18 8:17
Paulo Zemek17-Jan-18 8:17 
GeneralRe: C# TryParse() Pin
Jon McKee16-Jan-18 9:12
professionalJon McKee16-Jan-18 9:12 
GeneralRe: C# TryParse() Pin
Paulo Zemek17-Jan-18 8:16
Paulo Zemek17-Jan-18 8:16 
GeneralRe: C# TryParse() Pin
PeejayAdams18-Jan-18 0:03
PeejayAdams18-Jan-18 0:03 
GeneralRe: C# TryParse() Pin
Paulo Zemek18-Jan-18 7:31
Paulo Zemek18-Jan-18 7:31 
GeneralRe: C# TryParse() Pin
F-ES Sitecore1-Feb-18 5:40
professionalF-ES Sitecore1-Feb-18 5:40 
PeejayAdams wrote:
TryParse is "wrong" in many ways - violation of SRP, use of exceptions as a method of flow control and so forth

Your comments may be driven by a misunderstanding of how TryParse works under the covers. The "Try" in the name doesn't refer to the "try" statement for catching exceptions. The method parses as it goes and if it comes to a character it can't parse it returns false, so you could argue (tenuously I admit) that TryParse doesn't validate, it only parses. The alternatives are to split the methods out which means doing the validation aspect twice. Most people would agree that breaking SRP (if it does) for such a trivial and oft-used method is a great price to pay for the performance gained. You shouldn't adhere to principals so strongly that they have negative effects elsewhere. Yes SOLID is good, but don't throw the baby out with the bathwater.
GeneralRe: C# TryParse() Pin
Kevin McFarlane19-Jan-18 4:17
Kevin McFarlane19-Jan-18 4:17 
GeneralRe: C# TryParse() Pin
TheGreatAndPowerfulOz21-Jan-18 18:08
TheGreatAndPowerfulOz21-Jan-18 18:08 
GeneralThey used to be useful, not anymore Pin
Patje14-Jan-18 22:07
Patje14-Jan-18 22:07 
GeneralThey're palatable Pin
Mike Hankey14-Jan-18 18:15
mveMike Hankey14-Jan-18 18:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.