Click here to Skip to main content
15,888,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



 
GeneralI prefer to avoid them Pin
den2k8818-Jan-18 2:52
professionalden2k8818-Jan-18 2:52 
GeneralManipulating struct-arrays directly. Pin
Paulo Zemek17-Jan-18 8:19
mvaPaulo Zemek17-Jan-18 8:19 
GeneralLike so many things.... Pin
Dominic Burford17-Jan-18 4:51
professionalDominic Burford17-Jan-18 4:51 
Answernot more than one ref- or out parameter Pin
sx200816-Jan-18 7:17
sx200816-Jan-18 7:17 
Generalno idea or opinion on the matter Pin
Dennis E White16-Jan-18 4:33
professionalDennis E White16-Jan-18 4:33 
GeneralThey are ok if you know what you are doing Pin
RugbyLeague15-Jan-18 21:08
RugbyLeague15-Jan-18 21:08 
GeneralRe: They are ok if you know what you are doing Pin
obermd16-Jan-18 4:39
obermd16-Jan-18 4:39 
GeneralRe: They are ok if you know what you are doing Pin
Foothill16-Jan-18 4:56
professionalFoothill16-Jan-18 4:56 
Out parameters are useful when you want the same operation to behave differently in various situations. I found them useful in my own binary trees where there are use cases to throw an exception or not throw an exception when a key/value is not there. To me, the real purpose of using Out is to eek out minor performance gains since you don't include any Exception data on the stack.

The real reason that Out is in C# can likely be attributed to support for many different Win32 API calls that return HRESULT as-well-as creating a C-style struct containing information requested by the caller.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016

GeneralThey are what they are Pin
CPallini15-Jan-18 9:33
mveCPallini15-Jan-18 9:33 
GeneralRe: They are what they are Pin
Nemanja Trifunovic18-Jan-18 2:23
Nemanja Trifunovic18-Jan-18 2:23 
GeneralWith tuples, I think they are mostly unnecessary Pin
Marc Clifton15-Jan-18 7:07
mvaMarc Clifton15-Jan-18 7:07 
GeneralRe: With tuples, I think they are mostly unnecessary Pin
OriginalGriff15-Jan-18 11:20
mveOriginalGriff15-Jan-18 11:20 
GeneralRe: With tuples, I think they are mostly unnecessary Pin
Richard Deeming16-Jan-18 3:48
mveRichard Deeming16-Jan-18 3:48 
GeneralRe: With tuples, I think they are mostly unnecessary Pin
Slacker00716-Jan-18 4:21
professionalSlacker00716-Jan-18 4:21 
GeneralRe: With tuples, I think they are mostly unnecessary Pin
Stuart Dootson16-Jan-18 1:12
professionalStuart Dootson16-Jan-18 1:12 
GeneralRe: With tuples, I think they are mostly unnecessary Pin
Mel Padden16-Jan-18 2:43
Mel Padden16-Jan-18 2:43 
GeneralThey are just fine, if used wisely Pin
Slacker00715-Jan-18 3:37
professionalSlacker00715-Jan-18 3:37 
GeneralRe: They are just fine, if used wisely Pin
peterchen15-Jan-18 4:46
peterchen15-Jan-18 4:46 
GeneralRe: They are just fine, if used wisely Pin
Espen Harlinn15-Jan-18 5:01
professionalEspen Harlinn15-Jan-18 5:01 
GeneralRe: They are just fine, if used wisely Pin
Dirk Bahle15-Jan-18 5:24
Dirk Bahle15-Jan-18 5:24 
GeneralRe: They are just fine, if used wisely Pin
peterchen15-Jan-18 5:32
peterchen15-Jan-18 5:32 
GeneralC# TryParse() PinPopular
PeejayAdams15-Jan-18 0:55
PeejayAdams15-Jan-18 0:55 
GeneralRe: C# TryParse() Pin
Slacker00715-Jan-18 3:33
professionalSlacker00715-Jan-18 3:33 
GeneralRe: C# TryParse() Pin
PeejayAdams15-Jan-18 4:33
PeejayAdams15-Jan-18 4:33 
GeneralRe: C# TryParse() Pin
11917640 Member 15-Jan-18 5:30
11917640 Member 15-Jan-18 5:30 

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.