Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Agree with the other answers here, but one more thing to add:

Are you sure you want to use while(true)? The answer may very well be yes, but this this StackOverflow answer highlights some things to consider when using an "infinite" enumerator.

For example, Min, Max, Average, etc. methods will not fail gracefully. In the linked answer, Marc suggests adding a SanityCheck extension method that just puts an upper limit on how many iterations it'll process before throwing its hands in the air and calling it an invalid operation (or simply taking a max iterations argument to the method).

Agree with the other answers here, but one more thing to add:

Are you sure you want to use while(true)? The answer may very well be yes, but this StackOverflow answer highlights some things to consider when using an "infinite" enumerator.

For example, Min, Max, Average, etc. methods will not fail gracefully. In the linked answer, Marc suggests adding a SanityCheck extension method that just puts an upper limit on how many iterations it'll process before throwing its hands in the air and calling it an invalid operation (or simply taking a max iterations argument to the method).

Agree with the other answers here, but one more thing to add:

Are you sure you want to use while(true)? The answer may very well be yes, but this StackOverflow answer highlights some things to consider when using an "infinite" enumerator.

For example, Min, Max, Average, etc. methods will not fail gracefully. In the linked answer, Marc suggests adding a SanityCheck extension method that just puts an upper limit on how many iterations it'll process before throwing its hands in the air and calling it an invalid operation (or simply taking a max iterations argument to the method).

Source Link
Ocelot20
  • 1.9k
  • 11
  • 18

Agree with the other answers here, but one more thing to add:

Are you sure you want to use while(true)? The answer may very well be yes, but this StackOverflow answer highlights some things to consider when using an "infinite" enumerator.

For example, Min, Max, Average, etc. methods will not fail gracefully. In the linked answer, Marc suggests adding a SanityCheck extension method that just puts an upper limit on how many iterations it'll process before throwing its hands in the air and calling it an invalid operation (or simply taking a max iterations argument to the method).

lang-cs

AltStyle によって変換されたページ (->オリジナル) /