the question is more of a performance issue than elegancy, i speek for my self, but ...
having both options to implemet , which is faster for the cpu to compute, or if at the end it is the same (i tend to think it is, cause the condition is (x<10) same )
public int DidLogcount = 0; // DidLogCount is raised by +1 every time we deside, then condition is met
public bool MoreLogsAllowed()
{
if (DidLogcount < 10) return true;
else return false;
}
vs
public bool MoreLogsAllowed()
{
return DidLogcount < 10;
}
we most of time supposeto check if it's not null but, if we have to , it will incloud both cases, so guess i just narrowed it down (?) if i didn't miss any other issue.
i'll appriciate the correct answer. thx.
Rediting : I just wanted to mark correct answer but did a refresh on the page which loaded 3 more ...
going to wait form more votes ...and for now, I really want to thank you all! for sharing your knowledge , it did go through my mind though , the optimization issue by the compiler , so...having those printouts shows something although little difference is little by it's self, but when added to a pile of conditions , it is less little , I wouldn't say big unless we're talking about a real complex app. still a performance issue is never a small issue i should say, along with logic and readability thanks to @Steve & @Nick for actually testing it for us .