When professionals don't think
-
This is taken directly from a book on LINQ, and illustrates how you could use a IEnumerable<int> to generate a never ending sequence:
public static IEnumerable<int> GetList() { int i = 2; while (true) { i = i \* 2; if ((i <= 0) || (i > int.MaxValue)) { i = 2; Console.WriteLine("Enter to continue, CTRL-C to break."); Console.ReadLine(); } else { yield return i; } } }
For your homework, please list all the values for which "
i > int.MaxValue
" :laugh: Now, aren't we all glad he checked for less than zero as well?Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
A classic. Works really well with
unsigned int
, no negatives to the rescue. :)Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
This is taken directly from a book on LINQ, and illustrates how you could use a IEnumerable<int> to generate a never ending sequence:
public static IEnumerable<int> GetList() { int i = 2; while (true) { i = i \* 2; if ((i <= 0) || (i > int.MaxValue)) { i = 2; Console.WriteLine("Enter to continue, CTRL-C to break."); Console.ReadLine(); } else { yield return i; } } }
For your homework, please list all the values for which "
i > int.MaxValue
" :laugh: Now, aren't we all glad he checked for less than zero as well?Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
Had it been some C code before? And the guy to port it did not understand what he was doing?
-
Had it been some C code before? And the guy to port it did not understand what he was doing?
I think just the end of youur question/statement is all that is needed. :)
Bernhard Hiller wrote:
did not understand what he was doing?
Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
-
Had it been some C code before? And the guy to port it did not understand what he was doing?
Unfortunately not: the whole book is LINQ, which is not available in C (nor are IEnumerable interfaces). And I think they should know what they are doing: the two authors are "Community Program Manager for the Microsoft C# Team" and "Senior Program Manager in the Microsoft .NET Developer Platform Team" according to "about the Author". Now I think about it, it explains a lot about MS software, really... :laugh:
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
-
This is taken directly from a book on LINQ, and illustrates how you could use a IEnumerable<int> to generate a never ending sequence:
public static IEnumerable<int> GetList() { int i = 2; while (true) { i = i \* 2; if ((i <= 0) || (i > int.MaxValue)) { i = 2; Console.WriteLine("Enter to continue, CTRL-C to break."); Console.ReadLine(); } else { yield return i; } } }
For your homework, please list all the values for which "
i > int.MaxValue
" :laugh: Now, aren't we all glad he checked for less than zero as well?Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
-
This is taken directly from a book on LINQ, and illustrates how you could use a IEnumerable<int> to generate a never ending sequence:
public static IEnumerable<int> GetList() { int i = 2; while (true) { i = i \* 2; if ((i <= 0) || (i > int.MaxValue)) { i = 2; Console.WriteLine("Enter to continue, CTRL-C to break."); Console.ReadLine(); } else { yield return i; } } }
For your homework, please list all the values for which "
i > int.MaxValue
" :laugh: Now, aren't we all glad he checked for less than zero as well?Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
What book?
-- Kein Mitleid Für Die Mehrheit
-
This is taken directly from a book on LINQ, and illustrates how you could use a IEnumerable<int> to generate a never ending sequence:
public static IEnumerable<int> GetList() { int i = 2; while (true) { i = i \* 2; if ((i <= 0) || (i > int.MaxValue)) { i = 2; Console.WriteLine("Enter to continue, CTRL-C to break."); Console.ReadLine(); } else { yield return i; } } }
For your homework, please list all the values for which "
i > int.MaxValue
" :laugh: Now, aren't we all glad he checked for less than zero as well?Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
The books not by Dietel & Dietel by any chance? They seem to have written exactly one book (in c++ I suspect) then re-written if for a variety of OO languages. The VB.net X| book has
Get_Value_() Set_Value_()
methods over properties. We're currently using this as the course text X| :~ X|Sort of a cross between Lawrence of Arabia and Dilbert.[^]
-Or-
A Dead ringer for Kate Winslett[^] -
This is taken directly from a book on LINQ, and illustrates how you could use a IEnumerable<int> to generate a never ending sequence:
public static IEnumerable<int> GetList() { int i = 2; while (true) { i = i \* 2; if ((i <= 0) || (i > int.MaxValue)) { i = 2; Console.WriteLine("Enter to continue, CTRL-C to break."); Console.ReadLine(); } else { yield return i; } } }
For your homework, please list all the values for which "
i > int.MaxValue
" :laugh: Now, aren't we all glad he checked for less than zero as well?Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
-
:laugh: I hadn't thought of that!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
-
Unfortunately not: the whole book is LINQ, which is not available in C (nor are IEnumerable interfaces). And I think they should know what they are doing: the two authors are "Community Program Manager for the Microsoft C# Team" and "Senior Program Manager in the Microsoft .NET Developer Platform Team" according to "about the Author". Now I think about it, it explains a lot about MS software, really... :laugh:
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."