Click here to Skip to main content
15,881,380 members
Home / Discussions / C#
   

C#

 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 3:23
professionalFoothill20-Apr-16 3:23 
GeneralRe: 'out' keyword, to use or not to use Pin
OriginalGriff20-Apr-16 3:50
mveOriginalGriff20-Apr-16 3:50 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 4:15
professionalFoothill20-Apr-16 4:15 
GeneralRe: 'out' keyword, to use or not to use Pin
OriginalGriff20-Apr-16 4:30
mveOriginalGriff20-Apr-16 4:30 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 5:00
professionalFoothill20-Apr-16 5:00 
GeneralRe: 'out' keyword, to use or not to use Pin
OriginalGriff20-Apr-16 5:12
mveOriginalGriff20-Apr-16 5:12 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 5:41
professionalFoothill20-Apr-16 5:41 
GeneralRe: 'out' keyword, to use or not to use Pin
OriginalGriff20-Apr-16 6:22
mveOriginalGriff20-Apr-16 6:22 
Not just that, but yes.
The Exceptions part is just an example - there are load of other cases where you might want to use an out, but they are harder to explain in isolation.
For example, you might want to split out certain values from a collection and return the number of them:
C#
private int GetForSomeReason(List<MyClass> mc, out List<MyClass> result, string somethingToLookFor)
   {
   ...
That way, you can chain them together:
C#
int total = GetForSomeReason(myList, out listOfJoes, "joe") + GetForSomeReason(myList, out listOfMikes, "mike");
(I'm not suggesting that that's a good design, just a trivial example of a complicated scenario)
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 7:16
professionalFoothill20-Apr-16 7:16 
AnswerRe: 'out' keyword, to use or not to use Pin
Pete O'Hanlon19-Apr-16 23:01
mvePete O'Hanlon19-Apr-16 23:01 
GeneralRe: 'out' keyword, to use or not to use Pin
Nathan Minier20-Apr-16 1:51
professionalNathan Minier20-Apr-16 1:51 
GeneralRe: 'out' keyword, to use or not to use Pin
Pete O'Hanlon20-Apr-16 2:06
mvePete O'Hanlon20-Apr-16 2:06 
GeneralRe: 'out' keyword, to use or not to use Pin
Nathan Minier20-Apr-16 2:17
professionalNathan Minier20-Apr-16 2:17 
GeneralRe: 'out' keyword, to use or not to use Pin
Pete O'Hanlon20-Apr-16 2:36
mvePete O'Hanlon20-Apr-16 2:36 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 3:42
professionalFoothill20-Apr-16 3:42 
GeneralRe: 'out' keyword, to use or not to use Pin
Richard Deeming20-Apr-16 4:19
mveRichard Deeming20-Apr-16 4:19 
AnswerRe: 'out' keyword, to use or not to use Pin
Ian A Davidson20-Apr-16 0:09
Ian A Davidson20-Apr-16 0:09 
GeneralRe: 'out' keyword, to use or not to use Pin
Foothill20-Apr-16 4:34
professionalFoothill20-Apr-16 4:34 
QuestionWhile button is clicked Pin
tvks19-Apr-16 8:30
tvks19-Apr-16 8:30 
AnswerRe: While button is clicked Pin
clapclap19-Apr-16 8:32
clapclap19-Apr-16 8:32 
AnswerRe: While button is clicked Pin
koolprasad200319-Apr-16 18:26
professionalkoolprasad200319-Apr-16 18:26 
GeneralRe: While button is clicked Pin
CHill6020-Apr-16 1:25
mveCHill6020-Apr-16 1:25 
GeneralRe: While button is clicked Pin
koolprasad200320-Apr-16 1:33
professionalkoolprasad200320-Apr-16 1:33 
AnswerRe: While button is clicked Pin
CHill6020-Apr-16 2:14
mveCHill6020-Apr-16 2:14 
PraiseRe: While button is clicked Pin
tvks20-Apr-16 10:57
tvks20-Apr-16 10:57 

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.