Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
GeneralRe: Not all code paths return a value Pin
freakyit25-Jun-10 3:14
freakyit25-Jun-10 3:14 
GeneralRe: Not all code paths return a value Pin
OriginalGriff25-Jun-10 3:26
mveOriginalGriff25-Jun-10 3:26 
GeneralRe: Not all code paths return a value Pin
Luc Pattyn25-Jun-10 3:39
sitebuilderLuc Pattyn25-Jun-10 3:39 
GeneralRe: Not all code paths return a value Pin
Pete O'Hanlon25-Jun-10 3:45
mvePete O'Hanlon25-Jun-10 3:45 
GeneralRe: Not all code paths return a value Pin
Luc Pattyn25-Jun-10 4:06
sitebuilderLuc Pattyn25-Jun-10 4:06 
GeneralRe: Not all code paths return a value Pin
harold aptroot25-Jun-10 3:18
harold aptroot25-Jun-10 3:18 
GeneralRe: Not all code paths return a value Pin
freakyit25-Jun-10 3:26
freakyit25-Jun-10 3:26 
AnswerRe: Not all code paths return a value Pin
harold aptroot26-Jun-10 0:56
harold aptroot26-Jun-10 0:56 
I have been thinking about how it would make sense to write code like this.
After all, you wouldn't have written it like this if you had no reason to do so.

I think I figured it out - did you think that return value; only sets the value that will be returned, instead of immediately* returning that value? It all makes sense then - as long as they are not equal, you would keep the return value on false; and when they are equal you'd set the return value to true and exit the method.
The problem with that is, of course, that return doesn't "set the value that will be returned", it immediately* exits the method (and it also returns the specified value, of course)

*: except in the presence of try/finally
AnswerRe: Not all code paths return a value Pin
yu-jian26-Jun-10 7:47
yu-jian26-Jun-10 7:47 
Questionwhat to do after a read from a socket Timeout Pin
manustone25-Jun-10 1:38
manustone25-Jun-10 1:38 
AnswerRe: what to do after a read from a socket Timeout Pin
David Knechtges25-Jun-10 3:19
David Knechtges25-Jun-10 3:19 
AnswerRe: what to do after a read from a socket Timeout Pin
freakyit25-Jun-10 3:21
freakyit25-Jun-10 3:21 
GeneralRe: what to do after a read from a socket Timeout Pin
manustone29-Jun-10 23:16
manustone29-Jun-10 23:16 
AnswerRe: what to do after a read from a socket Timeout Pin
Ennis Ray Lynch, Jr.25-Jun-10 4:15
Ennis Ray Lynch, Jr.25-Jun-10 4:15 
GeneralRe: what to do after a read from a socket Timeout Pin
manustone29-Jun-10 23:16
manustone29-Jun-10 23:16 
QuestionCollection of unique ids Pin
Chiman125-Jun-10 0:38
Chiman125-Jun-10 0:38 
AnswerRe: Collection of unique ids Pin
Luc Pattyn25-Jun-10 0:51
sitebuilderLuc Pattyn25-Jun-10 0:51 
AnswerRe: Collection of unique ids Pin
OkkiePepernoot25-Jun-10 0:52
OkkiePepernoot25-Jun-10 0:52 
AnswerRe: Collection of unique ids Pin
David Skelly25-Jun-10 2:03
David Skelly25-Jun-10 2:03 
QuestionCom Exception - excel Pin
KaurGurpreet24-Jun-10 23:26
KaurGurpreet24-Jun-10 23:26 
AnswerRe: Com Exception - excel Pin
freakyit24-Jun-10 23:38
freakyit24-Jun-10 23:38 
GeneralRe: Com Exception - excel Pin
KaurGurpreet25-Jun-10 0:00
KaurGurpreet25-Jun-10 0:00 
AnswerRe: Com Exception - excel Pin
OkkiePepernoot25-Jun-10 0:30
OkkiePepernoot25-Jun-10 0:30 
GeneralRe: Com Exception - excel Pin
KaurGurpreet25-Jun-10 0:35
KaurGurpreet25-Jun-10 0:35 
GeneralRe: Com Exception - excel Pin
OkkiePepernoot25-Jun-10 0:45
OkkiePepernoot25-Jun-10 0:45 

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.